Versions in this module Expand all Collapse all v1 v1.0.0 Dec 9, 2024 Changes in this version + const NextProtoDQ + var CacheStrategy_name = map[int32]string + var CacheStrategy_value = map[string]int32 + var DomainMatchingType_name = map[int32]string + var DomainMatchingType_value = map[string]int32 + var FallbackStrategy_name = map[int32]string + var FallbackStrategy_value = map[string]int32 + var File_app_dns_config_proto protoreflect.FileDescriptor + var QueryStrategy_name = map[int32]string + var QueryStrategy_value = map[string]int32 + func Fqdn(domain string) string + func NewServer(ctx context.Context, dest net.Destination, onCreated func(Server) error) error + type CacheStrategy int32 + const CacheStrategy_CacheDisabled + const CacheStrategy_CacheEnabled + func (CacheStrategy) Descriptor() protoreflect.EnumDescriptor + func (CacheStrategy) EnumDescriptor() ([]byte, []int) + func (CacheStrategy) Type() protoreflect.EnumType + func (x CacheStrategy) Enum() *CacheStrategy + func (x CacheStrategy) Number() protoreflect.EnumNumber + func (x CacheStrategy) String() string + type ClassicNameServer struct + func NewClassicNameServer(address net.Destination, dispatcher routing.Dispatcher) *ClassicNameServer + func (s *ClassicNameServer) Cleanup() error + func (s *ClassicNameServer) HandleResponse(ctx context.Context, packet *udp_proto.Packet) + func (s *ClassicNameServer) Name() string + func (s *ClassicNameServer) QueryIP(ctx context.Context, domain string, clientIP net.IP, ...) ([]net.IP, error) + type Client struct + func NewClient(ctx context.Context, ns *NameServer, dns *Config) (*Client, error) + func NewLocalDNSClient() *Client + func (c *Client) MatchExpectedIPs(domain string, ips []net.IP) ([]net.IP, error) + func (c *Client) Name() string + func (c *Client) QueryIP(ctx context.Context, domain string, option dns.IPOption) ([]net.IP, error) + type Config struct + CacheStrategy CacheStrategy + ClientIp []byte + DisableCache bool + DisableFallback bool + DisableFallbackIfMatch bool + DomainMatcher string + FakeDns *fakedns.FakeDnsPoolMulti + FallbackStrategy FallbackStrategy + Hosts map[string]*net.IPOrDomain + NameServer []*NameServer + NameServers []*net.Endpoint + QueryStrategy QueryStrategy + StaticHosts []*HostMapping + Tag string + func (*Config) Descriptor() ([]byte, []int) + func (*Config) ProtoMessage() + func (x *Config) GetCacheStrategy() CacheStrategy + func (x *Config) GetClientIp() []byte + func (x *Config) GetDisableCache() bool + func (x *Config) GetDisableFallback() bool + func (x *Config) GetDisableFallbackIfMatch() bool + func (x *Config) GetDomainMatcher() string + func (x *Config) GetFakeDns() *fakedns.FakeDnsPoolMulti + func (x *Config) GetFallbackStrategy() FallbackStrategy + func (x *Config) GetHosts() map[string]*net.IPOrDomain + func (x *Config) GetNameServer() []*NameServer + func (x *Config) GetNameServers() []*net.Endpoint + func (x *Config) GetQueryStrategy() QueryStrategy + func (x *Config) GetStaticHosts() []*HostMapping + func (x *Config) GetTag() string + func (x *Config) ProtoReflect() protoreflect.Message + func (x *Config) Reset() + func (x *Config) String() string + type DNS struct + func New(ctx context.Context, config *Config) (*DNS, error) + func (*DNS) Type() interface{} + func (s *DNS) AsFakeDNSClient() dns.Client + func (s *DNS) AsFakeDNSEngine() dns.FakeDNSEngine + func (s *DNS) Close() error + func (s *DNS) IsOwnLink(ctx context.Context) bool + func (s *DNS) LookupIP(domain string) ([]net.IP, error) + func (s *DNS) LookupIPv4(domain string) ([]net.IP, error) + func (s *DNS) LookupIPv6(domain string) ([]net.IP, error) + func (s *DNS) Start() error + type DoHNameServer struct + func NewDoHLocalNameServer(url *url.URL) *DoHNameServer + func NewDoHNameServer(url *url.URL, dispatcher routing.Dispatcher) (*DoHNameServer, error) + func (s *DoHNameServer) Cleanup() error + func (s *DoHNameServer) Name() string + func (s *DoHNameServer) QueryIP(ctx context.Context, domain string, clientIP net.IP, ...) ([]net.IP, error) + type DomainMatcherInfo struct + type DomainMatchingType int32 + const DomainMatchingType_Full + const DomainMatchingType_Keyword + const DomainMatchingType_Regex + const DomainMatchingType_Subdomain + func (DomainMatchingType) Descriptor() protoreflect.EnumDescriptor + func (DomainMatchingType) EnumDescriptor() ([]byte, []int) + func (DomainMatchingType) Type() protoreflect.EnumType + func (x DomainMatchingType) Enum() *DomainMatchingType + func (x DomainMatchingType) Number() protoreflect.EnumNumber + func (x DomainMatchingType) String() string + type FakeDNSClient struct + func (s *FakeDNSClient) LookupIP(domain string) ([]net.IP, error) + func (s *FakeDNSClient) LookupIPv4(domain string) ([]net.IP, error) + func (s *FakeDNSClient) LookupIPv6(domain string) ([]net.IP, error) + type FakeDNSEngine struct + func (*FakeDNSEngine) Type() interface{} + func (f *FakeDNSEngine) Close() error + func (f *FakeDNSEngine) GetDomainFromFakeDNS(ip net.Address) string + func (f *FakeDNSEngine) GetFakeIPForDomain(domain string) []net.Address + func (f *FakeDNSEngine) GetFakeIPForDomain3(domain string, IPv4 bool, IPv6 bool) []net.Address + func (f *FakeDNSEngine) IsIPInIPPool(ip net.Address) bool + func (f *FakeDNSEngine) Start() error + type FakeDNSServer struct + func NewFakeDNSServer(fakeDNSEngine dns.FakeDNSEngine) *FakeDNSServer + func (FakeDNSServer) Name() string + func (f *FakeDNSServer) QueryIP(ctx context.Context, domain string, _ net.IP, opt dns.IPOption, _ bool) ([]net.IP, error) + type FallbackStrategy int32 + const FallbackStrategy_Disabled + const FallbackStrategy_DisabledIfAnyMatch + const FallbackStrategy_Enabled + func (FallbackStrategy) Descriptor() protoreflect.EnumDescriptor + func (FallbackStrategy) EnumDescriptor() ([]byte, []int) + func (FallbackStrategy) Type() protoreflect.EnumType + func (x FallbackStrategy) Enum() *FallbackStrategy + func (x FallbackStrategy) Number() protoreflect.EnumNumber + func (x FallbackStrategy) String() string + type HostMapping struct + Domain string + Ip [][]byte + ProxiedDomain string + Type DomainMatchingType + func (*HostMapping) Descriptor() ([]byte, []int) + func (*HostMapping) ProtoMessage() + func (x *HostMapping) GetDomain() string + func (x *HostMapping) GetIp() [][]byte + func (x *HostMapping) GetProxiedDomain() string + func (x *HostMapping) GetType() DomainMatchingType + func (x *HostMapping) ProtoReflect() protoreflect.Message + func (x *HostMapping) Reset() + func (x *HostMapping) String() string + type IPRecord struct + Expire time.Time + IP []net.Address + RCode dnsmessage.RCode + ReqID uint16 + type LocalNameServer struct + func NewLocalNameServer() *LocalNameServer + func (s *LocalNameServer) Name() string + func (s *LocalNameServer) QueryIP(_ context.Context, domain string, _ net.IP, option dns.IPOption, _ bool) ([]net.IP, error) + type NameServer struct + Address *net.Endpoint + CacheStrategy *CacheStrategy + ClientIp []byte + FakeDns *fakedns.FakeDnsPoolMulti + FallbackStrategy *FallbackStrategy + Geoip []*routercommon.GeoIP + OriginalRules []*NameServer_OriginalRule + PrioritizedDomain []*NameServer_PriorityDomain + QueryStrategy *QueryStrategy + SkipFallback bool + Tag string + func (*NameServer) Descriptor() ([]byte, []int) + func (*NameServer) ProtoMessage() + func (x *NameServer) GetAddress() *net.Endpoint + func (x *NameServer) GetCacheStrategy() CacheStrategy + func (x *NameServer) GetClientIp() []byte + func (x *NameServer) GetFakeDns() *fakedns.FakeDnsPoolMulti + func (x *NameServer) GetFallbackStrategy() FallbackStrategy + func (x *NameServer) GetGeoip() []*routercommon.GeoIP + func (x *NameServer) GetOriginalRules() []*NameServer_OriginalRule + func (x *NameServer) GetPrioritizedDomain() []*NameServer_PriorityDomain + func (x *NameServer) GetQueryStrategy() QueryStrategy + func (x *NameServer) GetSkipFallback() bool + func (x *NameServer) GetTag() string + func (x *NameServer) ProtoReflect() protoreflect.Message + func (x *NameServer) Reset() + func (x *NameServer) String() string + type NameServer_OriginalRule struct + Rule string + Size uint32 + func (*NameServer_OriginalRule) Descriptor() ([]byte, []int) + func (*NameServer_OriginalRule) ProtoMessage() + func (x *NameServer_OriginalRule) GetRule() string + func (x *NameServer_OriginalRule) GetSize() uint32 + func (x *NameServer_OriginalRule) ProtoReflect() protoreflect.Message + func (x *NameServer_OriginalRule) Reset() + func (x *NameServer_OriginalRule) String() string + type NameServer_PriorityDomain struct + Domain string + Type DomainMatchingType + func (*NameServer_PriorityDomain) Descriptor() ([]byte, []int) + func (*NameServer_PriorityDomain) ProtoMessage() + func (x *NameServer_PriorityDomain) GetDomain() string + func (x *NameServer_PriorityDomain) GetType() DomainMatchingType + func (x *NameServer_PriorityDomain) ProtoReflect() protoreflect.Message + func (x *NameServer_PriorityDomain) Reset() + func (x *NameServer_PriorityDomain) String() string + type QUICNameServer struct + func NewQUICNameServer(url *url.URL) (*QUICNameServer, error) + func (s *QUICNameServer) Cleanup() error + func (s *QUICNameServer) Name() string + func (s *QUICNameServer) QueryIP(ctx context.Context, domain string, clientIP net.IP, ...) ([]net.IP, error) + type QueryStrategy int32 + const QueryStrategy_USE_IP + const QueryStrategy_USE_IP4 + const QueryStrategy_USE_IP6 + func (QueryStrategy) Descriptor() protoreflect.EnumDescriptor + func (QueryStrategy) EnumDescriptor() ([]byte, []int) + func (QueryStrategy) Type() protoreflect.EnumType + func (x QueryStrategy) Enum() *QueryStrategy + func (x QueryStrategy) Number() protoreflect.EnumNumber + func (x QueryStrategy) String() string + type Server interface + Name func() string + QueryIP func(ctx context.Context, domain string, clientIP net.IP, option dns.IPOption, ...) ([]net.IP, error) + type SimplifiedConfig struct + CacheStrategy CacheStrategy + ClientIp string + DisableCache bool + DisableFallback bool + DisableFallbackIfMatch bool + DomainMatcher string + FakeDns *fakedns.FakeDnsPoolMulti + FallbackStrategy FallbackStrategy + NameServer []*SimplifiedNameServer + QueryStrategy QueryStrategy + StaticHosts []*SimplifiedHostMapping + Tag string + func (*SimplifiedConfig) Descriptor() ([]byte, []int) + func (*SimplifiedConfig) ProtoMessage() + func (x *SimplifiedConfig) GetCacheStrategy() CacheStrategy + func (x *SimplifiedConfig) GetClientIp() string + func (x *SimplifiedConfig) GetDisableCache() bool + func (x *SimplifiedConfig) GetDisableFallback() bool + func (x *SimplifiedConfig) GetDisableFallbackIfMatch() bool + func (x *SimplifiedConfig) GetDomainMatcher() string + func (x *SimplifiedConfig) GetFakeDns() *fakedns.FakeDnsPoolMulti + func (x *SimplifiedConfig) GetFallbackStrategy() FallbackStrategy + func (x *SimplifiedConfig) GetNameServer() []*SimplifiedNameServer + func (x *SimplifiedConfig) GetQueryStrategy() QueryStrategy + func (x *SimplifiedConfig) GetStaticHosts() []*SimplifiedHostMapping + func (x *SimplifiedConfig) GetTag() string + func (x *SimplifiedConfig) ProtoReflect() protoreflect.Message + func (x *SimplifiedConfig) Reset() + func (x *SimplifiedConfig) String() string + type SimplifiedHostMapping struct + Domain string + Ip []string + ProxiedDomain string + Type DomainMatchingType + func (*SimplifiedHostMapping) Descriptor() ([]byte, []int) + func (*SimplifiedHostMapping) ProtoMessage() + func (x *SimplifiedHostMapping) GetDomain() string + func (x *SimplifiedHostMapping) GetIp() []string + func (x *SimplifiedHostMapping) GetProxiedDomain() string + func (x *SimplifiedHostMapping) GetType() DomainMatchingType + func (x *SimplifiedHostMapping) ProtoReflect() protoreflect.Message + func (x *SimplifiedHostMapping) Reset() + func (x *SimplifiedHostMapping) String() string + type SimplifiedNameServer struct + Address *net.Endpoint + CacheStrategy *CacheStrategy + ClientIp string + FakeDns *fakedns.FakeDnsPoolMulti + FallbackStrategy *FallbackStrategy + GeoDomain []*routercommon.GeoSite + Geoip []*routercommon.GeoIP + OriginalRules []*SimplifiedNameServer_OriginalRule + PrioritizedDomain []*SimplifiedNameServer_PriorityDomain + QueryStrategy *QueryStrategy + SkipFallback bool + Tag string + func (*SimplifiedNameServer) Descriptor() ([]byte, []int) + func (*SimplifiedNameServer) ProtoMessage() + func (x *SimplifiedNameServer) GetAddress() *net.Endpoint + func (x *SimplifiedNameServer) GetCacheStrategy() CacheStrategy + func (x *SimplifiedNameServer) GetClientIp() string + func (x *SimplifiedNameServer) GetFakeDns() *fakedns.FakeDnsPoolMulti + func (x *SimplifiedNameServer) GetFallbackStrategy() FallbackStrategy + func (x *SimplifiedNameServer) GetGeoDomain() []*routercommon.GeoSite + func (x *SimplifiedNameServer) GetGeoip() []*routercommon.GeoIP + func (x *SimplifiedNameServer) GetOriginalRules() []*SimplifiedNameServer_OriginalRule + func (x *SimplifiedNameServer) GetPrioritizedDomain() []*SimplifiedNameServer_PriorityDomain + func (x *SimplifiedNameServer) GetQueryStrategy() QueryStrategy + func (x *SimplifiedNameServer) GetSkipFallback() bool + func (x *SimplifiedNameServer) GetTag() string + func (x *SimplifiedNameServer) ProtoReflect() protoreflect.Message + func (x *SimplifiedNameServer) Reset() + func (x *SimplifiedNameServer) String() string + type SimplifiedNameServer_OriginalRule struct + Rule string + Size uint32 + func (*SimplifiedNameServer_OriginalRule) Descriptor() ([]byte, []int) + func (*SimplifiedNameServer_OriginalRule) ProtoMessage() + func (x *SimplifiedNameServer_OriginalRule) GetRule() string + func (x *SimplifiedNameServer_OriginalRule) GetSize() uint32 + func (x *SimplifiedNameServer_OriginalRule) ProtoReflect() protoreflect.Message + func (x *SimplifiedNameServer_OriginalRule) Reset() + func (x *SimplifiedNameServer_OriginalRule) String() string + type SimplifiedNameServer_PriorityDomain struct + Domain string + Type DomainMatchingType + func (*SimplifiedNameServer_PriorityDomain) Descriptor() ([]byte, []int) + func (*SimplifiedNameServer_PriorityDomain) ProtoMessage() + func (x *SimplifiedNameServer_PriorityDomain) GetDomain() string + func (x *SimplifiedNameServer_PriorityDomain) GetType() DomainMatchingType + func (x *SimplifiedNameServer_PriorityDomain) ProtoReflect() protoreflect.Message + func (x *SimplifiedNameServer_PriorityDomain) Reset() + func (x *SimplifiedNameServer_PriorityDomain) String() string + type StaticHosts struct + func NewStaticHosts(hosts []*HostMapping, legacy map[string]*net.IPOrDomain) (*StaticHosts, error) + func (h *StaticHosts) Lookup(domain string, option dns.IPOption) []net.Address + type TCPNameServer struct + func NewTCPLocalNameServer(url *url.URL) (*TCPNameServer, error) + func NewTCPNameServer(url *url.URL, dispatcher routing.Dispatcher) (*TCPNameServer, error) + func (s *TCPNameServer) Cleanup() error + func (s *TCPNameServer) Name() string + func (s *TCPNameServer) QueryIP(ctx context.Context, domain string, clientIP net.IP, ...) ([]net.IP, error)