Versions in this module Expand all Collapse all v0 v0.0.1 Sep 18, 2023 Changes in this version + var ErrBadPortRange = E.New("bad port range") + 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 struct + func NewAuthUserItem(users []string) *AuthUserItem + func (r *AuthUserItem) Match(metadata *adapter.InboundContext) bool + func (r *AuthUserItem) String() string + type ClashModeItem struct + func NewClashModeItem(router adapter.Router, mode string) *ClashModeItem + func (r *ClashModeItem) Match(metadata *adapter.InboundContext) bool + func (r *ClashModeItem) String() string + type DNSReverseMapping struct + func NewDNSReverseMapping() *DNSReverseMapping + func (m *DNSReverseMapping) Query(address netip.Addr) (string, bool) + func (m *DNSReverseMapping) Save(address netip.Addr, domain string, ttl int) + type DefaultDNSRule struct + func NewDefaultDNSRule(router adapter.Router, logger log.ContextLogger, options option.DefaultDNSRule) (*DefaultDNSRule, error) + 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) RewriteTTL() *uint32 + func (r *DefaultDNSRule) Start() error + func (r *DefaultDNSRule) String() string + func (r *DefaultDNSRule) Type() string + func (r *DefaultDNSRule) UpdateGeosite() error + type DefaultRule struct + func NewDefaultRule(router adapter.Router, logger log.ContextLogger, options option.DefaultRule) (*DefaultRule, error) + func (r *DefaultRule) Close() error + func (r *DefaultRule) Match(metadata *adapter.InboundContext) bool + func (r *DefaultRule) Outbound() string + func (r *DefaultRule) Start() error + func (r *DefaultRule) String() string + func (r *DefaultRule) Type() string + func (r *DefaultRule) UpdateGeosite() error + type DomainItem struct + func NewDomainItem(domains []string, domainSuffixes []string) *DomainItem + func (r *DomainItem) Match(metadata *adapter.InboundContext) bool + func (r *DomainItem) String() string + type DomainKeywordItem struct + func NewDomainKeywordItem(keywords []string) *DomainKeywordItem + func (r *DomainKeywordItem) Match(metadata *adapter.InboundContext) bool + func (r *DomainKeywordItem) String() string + type DomainRegexItem struct + func NewDomainRegexItem(expressions []string) (*DomainRegexItem, error) + func (r *DomainRegexItem) Match(metadata *adapter.InboundContext) bool + func (r *DomainRegexItem) String() string + type GeoIPItem struct + func NewGeoIPItem(router adapter.Router, logger log.ContextLogger, isSource bool, codes []string) *GeoIPItem + func (r *GeoIPItem) Match(metadata *adapter.InboundContext) bool + func (r *GeoIPItem) String() string + type GeositeItem struct + func NewGeositeItem(router adapter.Router, logger log.ContextLogger, codes []string) *GeositeItem + func (r *GeositeItem) Match(metadata *adapter.InboundContext) bool + func (r *GeositeItem) String() string + func (r *GeositeItem) Update() error + type IPCIDRItem struct + func NewIPCIDRItem(isSource bool, prefixStrings []string) (*IPCIDRItem, error) + func (r *IPCIDRItem) Match(metadata *adapter.InboundContext) bool + func (r *IPCIDRItem) String() string + type IPVersionItem struct + func NewIPVersionItem(isIPv6 bool) *IPVersionItem + func (r *IPVersionItem) Match(metadata *adapter.InboundContext) bool + func (r *IPVersionItem) String() string + type InboundItem struct + func NewInboundRule(inbounds []string) *InboundItem + func (r *InboundItem) Match(metadata *adapter.InboundContext) bool + func (r *InboundItem) String() string + type LogicalDNSRule struct + func NewLogicalDNSRule(router adapter.Router, logger log.ContextLogger, options option.LogicalDNSRule) (*LogicalDNSRule, error) + 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) RewriteTTL() *uint32 + func (r *LogicalDNSRule) Start() error + func (r *LogicalDNSRule) String() string + func (r *LogicalDNSRule) Type() string + func (r *LogicalDNSRule) UpdateGeosite() error + type LogicalRule struct + func NewLogicalRule(router adapter.Router, logger log.ContextLogger, options option.LogicalRule) (*LogicalRule, error) + func (r *LogicalRule) Close() error + func (r *LogicalRule) Match(metadata *adapter.InboundContext) bool + func (r *LogicalRule) Outbound() string + func (r *LogicalRule) Start() error + func (r *LogicalRule) String() string + func (r *LogicalRule) Type() string + func (r *LogicalRule) UpdateGeosite() error + type NetworkItem struct + func NewNetworkItem(networks []string) *NetworkItem + func (r *NetworkItem) Match(metadata *adapter.InboundContext) bool + func (r *NetworkItem) String() string + type OutboundItem struct + func NewOutboundRule(outbounds []string) *OutboundItem + func (r *OutboundItem) Match(metadata *adapter.InboundContext) bool + func (r *OutboundItem) String() string + type PackageNameItem struct + func NewPackageNameItem(packageNameList []string) *PackageNameItem + func (r *PackageNameItem) Match(metadata *adapter.InboundContext) bool + func (r *PackageNameItem) String() string + type PortItem struct + func NewPortItem(isSource bool, ports []uint16) *PortItem + func (r *PortItem) Match(metadata *adapter.InboundContext) bool + func (r *PortItem) String() string + type PortRangeItem struct + func NewPortRangeItem(isSource bool, rangeList []string) (*PortRangeItem, error) + func (r *PortRangeItem) Match(metadata *adapter.InboundContext) bool + func (r *PortRangeItem) String() string + type ProcessItem struct + func NewProcessItem(processNameList []string) *ProcessItem + func (r *ProcessItem) Match(metadata *adapter.InboundContext) bool + func (r *ProcessItem) String() string + type ProcessPathItem struct + func NewProcessPathItem(processNameList []string) *ProcessPathItem + func (r *ProcessPathItem) Match(metadata *adapter.InboundContext) bool + func (r *ProcessPathItem) String() string + type ProtocolItem struct + func NewProtocolItem(protocols []string) *ProtocolItem + func (r *ProtocolItem) Match(metadata *adapter.InboundContext) bool + func (r *ProtocolItem) String() string + type QueryTypeItem struct + func NewQueryTypeItem(typeList []option.DNSQueryType) *QueryTypeItem + func (r *QueryTypeItem) Match(metadata *adapter.InboundContext) bool + func (r *QueryTypeItem) String() string + type Router struct + func NewRouter(ctx context.Context, logFactory log.Factory, options option.RouteOptions, ...) (*Router, error) + func (r *Router) AutoDetectInterface() bool + func (r *Router) AutoDetectInterfaceFunc() control.Func + func (r *Router) ClashServer() adapter.ClashServer + func (r *Router) ClearDNSCache() + 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 *mDNS.Msg) (*mDNS.Msg, error) + func (r *Router) FakeIPStore() adapter.FakeIPStore + func (r *Router) GeoIPReader() *geoip.Reader + func (r *Router) Initialize(inbounds []adapter.Inbound, outbounds []adapter.Outbound, ...) error + func (r *Router) InterfaceFinder() control.InterfaceFinder + 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) OnPackagesUpdated(packages int, sharedUsers int) + func (r *Router) Outbound(tag string) (adapter.Outbound, bool) + func (r *Router) Outbounds() []adapter.Outbound + func (r *Router) PackageManager() tun.PackageManager + func (r *Router) ResetNetwork() error + 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) SetClashServer(server adapter.ClashServer) + func (r *Router) SetV2RayServer(server adapter.V2RayServer) + func (r *Router) Start() error + func (r *Router) TimeFunc() func() time.Time + func (r *Router) UpdateInterfaces() error + func (r *Router) V2RayServer() adapter.V2RayServer + type RuleItem interface + Match func(metadata *adapter.InboundContext) bool + String func() string + type UserIdItem struct + func NewUserIDItem(userIdList []int32) *UserIdItem + func (r *UserIdItem) Match(metadata *adapter.InboundContext) bool + func (r *UserIdItem) String() string + type UserItem struct + func NewUserItem(users []string) *UserItem + func (r *UserItem) Match(metadata *adapter.InboundContext) bool + func (r *UserItem) String() string