611ce5f5f1
[Feat] add Pass type for support temporary skip rule set
33 lines
699 B
Go
33 lines
699 B
Go
package outbound
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"github.com/Dreamacro/clash/component/dialer"
|
|
|
|
C "github.com/Dreamacro/clash/constant"
|
|
)
|
|
|
|
type Pass struct {
|
|
*Base
|
|
}
|
|
|
|
// DialContext implements C.ProxyAdapter
|
|
func (r *Pass) DialContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.Conn, error) {
|
|
return nil, errors.New("match Pass rule")
|
|
}
|
|
|
|
// ListenPacketContext implements C.ProxyAdapter
|
|
func (r *Pass) ListenPacketContext(ctx context.Context, metadata *C.Metadata, opts ...dialer.Option) (C.PacketConn, error) {
|
|
return nil, errors.New("match Pass rule")
|
|
}
|
|
|
|
func NewPass() *Pass {
|
|
return &Pass{
|
|
Base: &Base{
|
|
name: "PASS",
|
|
tp: C.Pass,
|
|
udp: true,
|
|
},
|
|
}
|
|
}
|