mihomo/adapter/outbound/pass.go
MetaCubeX 611ce5f5f1 [commit]
[Feat] add Pass type for support temporary skip rule set
2022-03-27 23:44:51 +08:00

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,
},
}
}