Documentation ¶
Index ¶
- Variables
- func LogDNSAnswers(logger log.ContextLogger, ctx context.Context, domain string, ...)
- func NewDNSRule(router adapter.Router, logger log.ContextLogger, options option.DNSRule) (adapter.DNSRule, error)
- func NewRule(router adapter.Router, logger log.ContextLogger, options option.Rule) (adapter.Rule, error)
- type AuthUserItem
- type DefaultDNSRule
- func (r *DefaultDNSRule) Close() error
- func (r *DefaultDNSRule) DisableCache() bool
- func (r *DefaultDNSRule) Match(metadata *adapter.InboundContext) bool
- func (r *DefaultDNSRule) Outbound() string
- func (r *DefaultDNSRule) Start() error
- func (r *DefaultDNSRule) String() string
- func (r *DefaultDNSRule) Type() string
- func (r *DefaultDNSRule) UpdateGeosite() error
- type DefaultRule
- type DomainItem
- type DomainKeywordItem
- type DomainRegexItem
- type GeoIPItem
- type GeositeItem
- type IPCIDRItem
- type IPVersionItem
- type InboundItem
- type LogicalDNSRule
- func (r *LogicalDNSRule) Close() error
- func (r *LogicalDNSRule) DisableCache() bool
- func (r *LogicalDNSRule) Match(metadata *adapter.InboundContext) bool
- func (r *LogicalDNSRule) Outbound() string
- func (r *LogicalDNSRule) Start() error
- func (r *LogicalDNSRule) String() string
- func (r *LogicalDNSRule) Type() string
- func (r *LogicalDNSRule) UpdateGeosite() error
- type LogicalRule
- type NetworkItem
- type OutboundItem
- type PackageNameItem
- type PortItem
- type PortRangeItem
- type ProcessItem
- type ProtocolItem
- type Router
- func (r *Router) AutoDetectInterface() bool
- func (r *Router) Close() error
- func (r *Router) DefaultInterface() string
- func (r *Router) DefaultMark() int
- func (r *Router) DefaultOutbound(network string) adapter.Outbound
- func (r *Router) Exchange(ctx context.Context, message *dnsmessage.Message) (*dnsmessage.Message, error)
- func (r *Router) GeoIPReader() *geoip.Reader
- func (r *Router) Initialize(outbounds []adapter.Outbound, defaultOutbound func() adapter.Outbound) error
- func (r *Router) InterfaceBindManager() control.BindManager
- func (r *Router) InterfaceMonitor() tun.DefaultInterfaceMonitor
- func (r *Router) LoadGeosite(code string) (adapter.Rule, error)
- func (r *Router) Lookup(ctx context.Context, domain string, strategy dns.DomainStrategy) ([]netip.Addr, error)
- func (r *Router) LookupDefault(ctx context.Context, domain string) ([]netip.Addr, error)
- func (r *Router) NetworkMonitor() tun.NetworkUpdateMonitor
- func (r *Router) NewError(ctx context.Context, err error)
- func (r *Router) Outbound(tag string) (adapter.Outbound, bool)
- func (r *Router) Outbounds() []adapter.Outbound
- func (r *Router) RouteConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error
- func (r *Router) RoutePacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext) error
- func (r *Router) Rules() []adapter.Rule
- func (r *Router) SetTrafficController(controller adapter.TrafficController)
- func (r *Router) Start() error
- type RuleItem
- type UserIdItem
- type UserItem
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBadPortRange = E.New("bad port range")
Functions ¶
func LogDNSAnswers ¶
func LogDNSAnswers(logger log.ContextLogger, ctx context.Context, domain string, answers []dnsmessage.Resource)
func NewDNSRule ¶
Types ¶
type AuthUserItem ¶
type AuthUserItem struct {
// contains filtered or unexported fields
}
func NewAuthUserItem ¶
func NewAuthUserItem(users []string) *AuthUserItem
func (*AuthUserItem) Match ¶
func (r *AuthUserItem) Match(metadata *adapter.InboundContext) bool
func (*AuthUserItem) String ¶
func (r *AuthUserItem) String() string
type DefaultDNSRule ¶
type DefaultDNSRule struct {
// contains filtered or unexported fields
}
func NewDefaultDNSRule ¶
func NewDefaultDNSRule(router adapter.Router, logger log.ContextLogger, options option.DefaultDNSRule) (*DefaultDNSRule, error)
func (*DefaultDNSRule) Close ¶
func (r *DefaultDNSRule) Close() error
func (*DefaultDNSRule) DisableCache ¶
func (r *DefaultDNSRule) DisableCache() bool
func (*DefaultDNSRule) Match ¶
func (r *DefaultDNSRule) Match(metadata *adapter.InboundContext) bool
func (*DefaultDNSRule) Outbound ¶
func (r *DefaultDNSRule) Outbound() string
func (*DefaultDNSRule) Start ¶
func (r *DefaultDNSRule) Start() error
func (*DefaultDNSRule) String ¶
func (r *DefaultDNSRule) String() string
func (*DefaultDNSRule) Type ¶
func (r *DefaultDNSRule) Type() string
func (*DefaultDNSRule) UpdateGeosite ¶
func (r *DefaultDNSRule) UpdateGeosite() error
type DefaultRule ¶
type DefaultRule struct {
// contains filtered or unexported fields
}
func NewDefaultRule ¶
func NewDefaultRule(router adapter.Router, logger log.ContextLogger, options option.DefaultRule) (*DefaultRule, error)
func (*DefaultRule) Close ¶
func (r *DefaultRule) Close() error
func (*DefaultRule) Match ¶
func (r *DefaultRule) Match(metadata *adapter.InboundContext) bool
func (*DefaultRule) Outbound ¶
func (r *DefaultRule) Outbound() string
func (*DefaultRule) Start ¶
func (r *DefaultRule) Start() error
func (*DefaultRule) String ¶
func (r *DefaultRule) String() string
func (*DefaultRule) Type ¶
func (r *DefaultRule) Type() string
func (*DefaultRule) UpdateGeosite ¶
func (r *DefaultRule) UpdateGeosite() error
type DomainItem ¶
type DomainItem struct {
// contains filtered or unexported fields
}
func NewDomainItem ¶
func NewDomainItem(domains []string, domainSuffixes []string) *DomainItem
func (*DomainItem) Match ¶
func (r *DomainItem) Match(metadata *adapter.InboundContext) bool
func (*DomainItem) String ¶
func (r *DomainItem) String() string
type DomainKeywordItem ¶
type DomainKeywordItem struct {
// contains filtered or unexported fields
}
func NewDomainKeywordItem ¶
func NewDomainKeywordItem(keywords []string) *DomainKeywordItem
func (*DomainKeywordItem) Match ¶
func (r *DomainKeywordItem) Match(metadata *adapter.InboundContext) bool
func (*DomainKeywordItem) String ¶
func (r *DomainKeywordItem) String() string
type DomainRegexItem ¶
type DomainRegexItem struct {
// contains filtered or unexported fields
}
func NewDomainRegexItem ¶
func NewDomainRegexItem(expressions []string) (*DomainRegexItem, error)
func (*DomainRegexItem) Match ¶
func (r *DomainRegexItem) Match(metadata *adapter.InboundContext) bool
func (*DomainRegexItem) String ¶
func (r *DomainRegexItem) String() string
type GeoIPItem ¶
type GeoIPItem struct {
// contains filtered or unexported fields
}
func NewGeoIPItem ¶
type GeositeItem ¶
type GeositeItem struct {
// contains filtered or unexported fields
}
func NewGeositeItem ¶
func NewGeositeItem(router adapter.Router, logger log.ContextLogger, codes []string) *GeositeItem
func (*GeositeItem) Match ¶
func (r *GeositeItem) Match(metadata *adapter.InboundContext) bool
func (*GeositeItem) String ¶
func (r *GeositeItem) String() string
func (*GeositeItem) Update ¶
func (r *GeositeItem) Update() error
type IPCIDRItem ¶
type IPCIDRItem struct {
// contains filtered or unexported fields
}
func NewIPCIDRItem ¶
func NewIPCIDRItem(isSource bool, prefixStrings []string) (*IPCIDRItem, error)
func (*IPCIDRItem) Match ¶
func (r *IPCIDRItem) Match(metadata *adapter.InboundContext) bool
func (*IPCIDRItem) String ¶
func (r *IPCIDRItem) String() string
type IPVersionItem ¶
type IPVersionItem struct {
// contains filtered or unexported fields
}
func NewIPVersionItem ¶
func NewIPVersionItem(isIPv6 bool) *IPVersionItem
func (*IPVersionItem) Match ¶
func (r *IPVersionItem) Match(metadata *adapter.InboundContext) bool
func (*IPVersionItem) String ¶
func (r *IPVersionItem) String() string
type InboundItem ¶
type InboundItem struct {
// contains filtered or unexported fields
}
func NewInboundRule ¶
func NewInboundRule(inbounds []string) *InboundItem
func (*InboundItem) Match ¶
func (r *InboundItem) Match(metadata *adapter.InboundContext) bool
func (*InboundItem) String ¶
func (r *InboundItem) String() string
type LogicalDNSRule ¶
type LogicalDNSRule struct {
// contains filtered or unexported fields
}
func NewLogicalDNSRule ¶
func NewLogicalDNSRule(router adapter.Router, logger log.ContextLogger, options option.LogicalDNSRule) (*LogicalDNSRule, error)
func (*LogicalDNSRule) Close ¶
func (r *LogicalDNSRule) Close() error
func (*LogicalDNSRule) DisableCache ¶
func (r *LogicalDNSRule) DisableCache() bool
func (*LogicalDNSRule) Match ¶
func (r *LogicalDNSRule) Match(metadata *adapter.InboundContext) bool
func (*LogicalDNSRule) Outbound ¶
func (r *LogicalDNSRule) Outbound() string
func (*LogicalDNSRule) Start ¶
func (r *LogicalDNSRule) Start() error
func (*LogicalDNSRule) String ¶
func (r *LogicalDNSRule) String() string
func (*LogicalDNSRule) Type ¶
func (r *LogicalDNSRule) Type() string
func (*LogicalDNSRule) UpdateGeosite ¶
func (r *LogicalDNSRule) UpdateGeosite() error
type LogicalRule ¶
type LogicalRule struct {
// contains filtered or unexported fields
}
func NewLogicalRule ¶
func NewLogicalRule(router adapter.Router, logger log.ContextLogger, options option.LogicalRule) (*LogicalRule, error)
func (*LogicalRule) Close ¶
func (r *LogicalRule) Close() error
func (*LogicalRule) Match ¶
func (r *LogicalRule) Match(metadata *adapter.InboundContext) bool
func (*LogicalRule) Outbound ¶
func (r *LogicalRule) Outbound() string
func (*LogicalRule) Start ¶
func (r *LogicalRule) Start() error
func (*LogicalRule) String ¶
func (r *LogicalRule) String() string
func (*LogicalRule) Type ¶
func (r *LogicalRule) Type() string
func (*LogicalRule) UpdateGeosite ¶
func (r *LogicalRule) UpdateGeosite() error
type NetworkItem ¶
type NetworkItem struct {
// contains filtered or unexported fields
}
func NewNetworkItem ¶
func NewNetworkItem(network string) *NetworkItem
func (*NetworkItem) Match ¶
func (r *NetworkItem) Match(metadata *adapter.InboundContext) bool
func (*NetworkItem) String ¶
func (r *NetworkItem) String() string
type OutboundItem ¶
type OutboundItem struct {
// contains filtered or unexported fields
}
func NewOutboundRule ¶
func NewOutboundRule(outbounds []string) *OutboundItem
func (*OutboundItem) Match ¶
func (r *OutboundItem) Match(metadata *adapter.InboundContext) bool
func (*OutboundItem) String ¶
func (r *OutboundItem) String() string
type PackageNameItem ¶
type PackageNameItem struct {
// contains filtered or unexported fields
}
func NewPackageNameItem ¶
func NewPackageNameItem(packageNameList []string) *PackageNameItem
func (*PackageNameItem) Match ¶
func (r *PackageNameItem) Match(metadata *adapter.InboundContext) bool
func (*PackageNameItem) String ¶
func (r *PackageNameItem) String() string
type PortItem ¶
type PortItem struct {
// contains filtered or unexported fields
}
func NewPortItem ¶
type PortRangeItem ¶
type PortRangeItem struct {
// contains filtered or unexported fields
}
func NewPortRangeItem ¶
func NewPortRangeItem(isSource bool, rangeList []string) (*PortRangeItem, error)
func (*PortRangeItem) Match ¶
func (r *PortRangeItem) Match(metadata *adapter.InboundContext) bool
func (*PortRangeItem) String ¶
func (r *PortRangeItem) String() string
type ProcessItem ¶
type ProcessItem struct {
// contains filtered or unexported fields
}
func NewProcessItem ¶
func NewProcessItem(processNameList []string) *ProcessItem
func (*ProcessItem) Match ¶
func (r *ProcessItem) Match(metadata *adapter.InboundContext) bool
func (*ProcessItem) String ¶
func (r *ProcessItem) String() string
type ProtocolItem ¶
type ProtocolItem struct {
// contains filtered or unexported fields
}
func NewProtocolItem ¶
func NewProtocolItem(protocols []string) *ProtocolItem
func (*ProtocolItem) Match ¶
func (r *ProtocolItem) Match(metadata *adapter.InboundContext) bool
func (*ProtocolItem) String ¶
func (r *ProtocolItem) String() string
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func NewRouter ¶
func NewRouter(ctx context.Context, logger log.ContextLogger, dnsLogger log.ContextLogger, options option.RouteOptions, dnsOptions option.DNSOptions, inbounds []option.Inbound) (*Router, error)
func (*Router) AutoDetectInterface ¶
func (*Router) DefaultInterface ¶
func (*Router) DefaultMark ¶
func (*Router) Exchange ¶
func (r *Router) Exchange(ctx context.Context, message *dnsmessage.Message) (*dnsmessage.Message, error)
func (*Router) GeoIPReader ¶
func (*Router) Initialize ¶
func (*Router) InterfaceBindManager ¶
func (r *Router) InterfaceBindManager() control.BindManager
func (*Router) InterfaceMonitor ¶
func (r *Router) InterfaceMonitor() tun.DefaultInterfaceMonitor
func (*Router) LookupDefault ¶
func (*Router) NetworkMonitor ¶
func (r *Router) NetworkMonitor() tun.NetworkUpdateMonitor
func (*Router) RouteConnection ¶
func (*Router) RoutePacketConnection ¶
func (r *Router) RoutePacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext) error
func (*Router) SetTrafficController ¶
func (r *Router) SetTrafficController(controller adapter.TrafficController)
type RuleItem ¶
type RuleItem interface { Match(metadata *adapter.InboundContext) bool String() string }
type UserIdItem ¶
type UserIdItem struct {
// contains filtered or unexported fields
}
func NewUserIDItem ¶
func NewUserIDItem(userIdList []int32) *UserIdItem
func (*UserIdItem) Match ¶
func (r *UserIdItem) Match(metadata *adapter.InboundContext) bool
func (*UserIdItem) String ¶
func (r *UserIdItem) String() string
Source Files ¶
- router.go
- router_dns.go
- rule.go
- rule_auth_user.go
- rule_cidr.go
- rule_dns.go
- rule_domain.go
- rule_domain_keyword.go
- rule_domain_regex.go
- rule_geoip.go
- rule_geosite.go
- rule_inbound.go
- rule_ipversion.go
- rule_network.go
- rule_outbound.go
- rule_package_name.go
- rule_port.go
- rule_port_range.go
- rule_process.go
- rule_protocol.go
- rule_user.go
- rule_user_id.go
Click to show internal directories.
Click to hide internal directories.