Documentation ¶
Overview ¶
Package dns is an implementation of core.DNS feature.
Index ¶
- Constants
- Variables
- func Fqdn(domain string) string
- func NewServer(ctx context.Context, dest net.Destination, onCreated func(Server) error) error
- type CacheStrategy
- func (CacheStrategy) Descriptor() protoreflect.EnumDescriptor
- func (x CacheStrategy) Enum() *CacheStrategy
- func (CacheStrategy) EnumDescriptor() ([]byte, []int)deprecated
- func (x CacheStrategy) Number() protoreflect.EnumNumber
- func (x CacheStrategy) String() string
- func (CacheStrategy) Type() protoreflect.EnumType
- type ClassicNameServer
- type Client
- type Config
- func (*Config) Descriptor() ([]byte, []int)deprecated
- func (x *Config) GetCacheStrategy() CacheStrategy
- func (x *Config) GetClientIp() []byte
- func (x *Config) GetDisableCache() booldeprecated
- func (x *Config) GetDisableFallback() booldeprecated
- func (x *Config) GetDisableFallbackIfMatch() booldeprecated
- func (x *Config) GetDomainMatcher() string
- func (x *Config) GetFakeDns() *fakedns.FakeDnsPoolMulti
- func (x *Config) GetFallbackStrategy() FallbackStrategy
- func (x *Config) GetHosts() map[string]*net.IPOrDomaindeprecated
- func (x *Config) GetNameServer() []*NameServer
- func (x *Config) GetNameServers() []*net.Endpointdeprecated
- func (x *Config) GetQueryStrategy() QueryStrategy
- func (x *Config) GetStaticHosts() []*HostMapping
- func (x *Config) GetTag() string
- func (*Config) ProtoMessage()
- func (x *Config) ProtoReflect() protoreflect.Message
- func (x *Config) Reset()
- func (x *Config) String() string
- type DNS
- 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
- func (*DNS) Type() interface{}
- type DoHNameServer
- type DomainMatcherInfo
- type DomainMatchingType
- func (DomainMatchingType) Descriptor() protoreflect.EnumDescriptor
- func (x DomainMatchingType) Enum() *DomainMatchingType
- func (DomainMatchingType) EnumDescriptor() ([]byte, []int)deprecated
- func (x DomainMatchingType) Number() protoreflect.EnumNumber
- func (x DomainMatchingType) String() string
- func (DomainMatchingType) Type() protoreflect.EnumType
- type FakeDNSClient
- type FakeDNSEngine
- 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
- func (*FakeDNSEngine) Type() interface{}
- type FakeDNSServer
- type FallbackStrategy
- func (FallbackStrategy) Descriptor() protoreflect.EnumDescriptor
- func (x FallbackStrategy) Enum() *FallbackStrategy
- func (FallbackStrategy) EnumDescriptor() ([]byte, []int)deprecated
- func (x FallbackStrategy) Number() protoreflect.EnumNumber
- func (x FallbackStrategy) String() string
- func (FallbackStrategy) Type() protoreflect.EnumType
- type HostMapping
- func (*HostMapping) Descriptor() ([]byte, []int)deprecated
- func (x *HostMapping) GetDomain() string
- func (x *HostMapping) GetIp() [][]byte
- func (x *HostMapping) GetProxiedDomain() string
- func (x *HostMapping) GetType() DomainMatchingType
- func (*HostMapping) ProtoMessage()
- func (x *HostMapping) ProtoReflect() protoreflect.Message
- func (x *HostMapping) Reset()
- func (x *HostMapping) String() string
- type IPRecord
- type LocalNameServer
- type NameServer
- func (*NameServer) Descriptor() ([]byte, []int)deprecated
- 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() booldeprecated
- func (x *NameServer) GetTag() string
- func (*NameServer) ProtoMessage()
- func (x *NameServer) ProtoReflect() protoreflect.Message
- func (x *NameServer) Reset()
- func (x *NameServer) String() string
- type NameServer_OriginalRule
- func (*NameServer_OriginalRule) Descriptor() ([]byte, []int)deprecated
- func (x *NameServer_OriginalRule) GetRule() string
- func (x *NameServer_OriginalRule) GetSize() uint32
- func (*NameServer_OriginalRule) ProtoMessage()
- func (x *NameServer_OriginalRule) ProtoReflect() protoreflect.Message
- func (x *NameServer_OriginalRule) Reset()
- func (x *NameServer_OriginalRule) String() string
- type NameServer_PriorityDomain
- func (*NameServer_PriorityDomain) Descriptor() ([]byte, []int)deprecated
- func (x *NameServer_PriorityDomain) GetDomain() string
- func (x *NameServer_PriorityDomain) GetType() DomainMatchingType
- func (*NameServer_PriorityDomain) ProtoMessage()
- func (x *NameServer_PriorityDomain) ProtoReflect() protoreflect.Message
- func (x *NameServer_PriorityDomain) Reset()
- func (x *NameServer_PriorityDomain) String() string
- type QUICNameServer
- type QueryStrategy
- func (QueryStrategy) Descriptor() protoreflect.EnumDescriptor
- func (x QueryStrategy) Enum() *QueryStrategy
- func (QueryStrategy) EnumDescriptor() ([]byte, []int)deprecated
- func (x QueryStrategy) Number() protoreflect.EnumNumber
- func (x QueryStrategy) String() string
- func (QueryStrategy) Type() protoreflect.EnumType
- type Server
- type SimplifiedConfig
- func (*SimplifiedConfig) Descriptor() ([]byte, []int)deprecated
- func (x *SimplifiedConfig) GetCacheStrategy() CacheStrategy
- func (x *SimplifiedConfig) GetClientIp() string
- func (x *SimplifiedConfig) GetDisableCache() booldeprecated
- func (x *SimplifiedConfig) GetDisableFallback() booldeprecated
- func (x *SimplifiedConfig) GetDisableFallbackIfMatch() booldeprecated
- 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 (*SimplifiedConfig) ProtoMessage()
- func (x *SimplifiedConfig) ProtoReflect() protoreflect.Message
- func (x *SimplifiedConfig) Reset()
- func (x *SimplifiedConfig) String() string
- type SimplifiedHostMapping
- func (*SimplifiedHostMapping) Descriptor() ([]byte, []int)deprecated
- func (x *SimplifiedHostMapping) GetDomain() string
- func (x *SimplifiedHostMapping) GetIp() []string
- func (x *SimplifiedHostMapping) GetProxiedDomain() string
- func (x *SimplifiedHostMapping) GetType() DomainMatchingType
- func (*SimplifiedHostMapping) ProtoMessage()
- func (x *SimplifiedHostMapping) ProtoReflect() protoreflect.Message
- func (x *SimplifiedHostMapping) Reset()
- func (x *SimplifiedHostMapping) String() string
- type SimplifiedNameServer
- func (*SimplifiedNameServer) Descriptor() ([]byte, []int)deprecated
- 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) GetGeoip() []*routercommon.GeoIP
- func (x *SimplifiedNameServer) GetOriginalRules() []*SimplifiedNameServer_OriginalRule
- func (x *SimplifiedNameServer) GetPrioritizedDomain() []*SimplifiedNameServer_PriorityDomain
- func (x *SimplifiedNameServer) GetQueryStrategy() QueryStrategy
- func (x *SimplifiedNameServer) GetSkipFallback() booldeprecated
- func (x *SimplifiedNameServer) GetTag() string
- func (*SimplifiedNameServer) ProtoMessage()
- func (x *SimplifiedNameServer) ProtoReflect() protoreflect.Message
- func (x *SimplifiedNameServer) Reset()
- func (x *SimplifiedNameServer) String() string
- type SimplifiedNameServer_OriginalRule
- func (*SimplifiedNameServer_OriginalRule) Descriptor() ([]byte, []int)deprecated
- func (x *SimplifiedNameServer_OriginalRule) GetRule() string
- func (x *SimplifiedNameServer_OriginalRule) GetSize() uint32
- func (*SimplifiedNameServer_OriginalRule) ProtoMessage()
- func (x *SimplifiedNameServer_OriginalRule) ProtoReflect() protoreflect.Message
- func (x *SimplifiedNameServer_OriginalRule) Reset()
- func (x *SimplifiedNameServer_OriginalRule) String() string
- type SimplifiedNameServer_PriorityDomain
- func (*SimplifiedNameServer_PriorityDomain) Descriptor() ([]byte, []int)deprecated
- func (x *SimplifiedNameServer_PriorityDomain) GetDomain() string
- func (x *SimplifiedNameServer_PriorityDomain) GetType() DomainMatchingType
- func (*SimplifiedNameServer_PriorityDomain) ProtoMessage()
- func (x *SimplifiedNameServer_PriorityDomain) ProtoReflect() protoreflect.Message
- func (x *SimplifiedNameServer_PriorityDomain) Reset()
- func (x *SimplifiedNameServer_PriorityDomain) String() string
- type StaticHosts
- type TCPNameServer
Constants ¶
const NextProtoDQ = "doq"
NextProtoDQ - During connection establishment, DNS/QUIC support is indicated by selecting the ALPN token "doq" in the crypto handshake.
Variables ¶
var ( DomainMatchingType_name = map[int32]string{ 0: "Full", 1: "Subdomain", 2: "Keyword", 3: "Regex", } DomainMatchingType_value = map[string]int32{ "Full": 0, "Subdomain": 1, "Keyword": 2, "Regex": 3, } )
Enum value maps for DomainMatchingType.
var ( QueryStrategy_name = map[int32]string{ 0: "USE_IP", 1: "USE_IP4", 2: "USE_IP6", } QueryStrategy_value = map[string]int32{ "USE_IP": 0, "USE_IP4": 1, "USE_IP6": 2, } )
Enum value maps for QueryStrategy.
var ( CacheStrategy_name = map[int32]string{ 0: "CacheEnabled", 1: "CacheDisabled", } CacheStrategy_value = map[string]int32{ "CacheEnabled": 0, "CacheDisabled": 1, } )
Enum value maps for CacheStrategy.
var ( FallbackStrategy_name = map[int32]string{ 0: "Enabled", 1: "Disabled", 2: "DisabledIfAnyMatch", } FallbackStrategy_value = map[string]int32{ "Enabled": 0, "Disabled": 1, "DisabledIfAnyMatch": 2, } )
Enum value maps for FallbackStrategy.
var File_app_dns_config_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type CacheStrategy ¶
type CacheStrategy int32
const ( CacheStrategy_CacheEnabled CacheStrategy = 0 CacheStrategy_CacheDisabled CacheStrategy = 1 )
func (CacheStrategy) Descriptor ¶
func (CacheStrategy) Descriptor() protoreflect.EnumDescriptor
func (CacheStrategy) Enum ¶
func (x CacheStrategy) Enum() *CacheStrategy
func (CacheStrategy) EnumDescriptor
deprecated
func (CacheStrategy) EnumDescriptor() ([]byte, []int)
Deprecated: Use CacheStrategy.Descriptor instead.
func (CacheStrategy) Number ¶
func (x CacheStrategy) Number() protoreflect.EnumNumber
func (CacheStrategy) String ¶
func (x CacheStrategy) String() string
func (CacheStrategy) Type ¶
func (CacheStrategy) Type() protoreflect.EnumType
type ClassicNameServer ¶
ClassicNameServer implemented traditional UDP DNS.
func NewClassicNameServer ¶
func NewClassicNameServer(address net.Destination, dispatcher routing.Dispatcher) *ClassicNameServer
NewClassicNameServer creates udp server object for remote resolving.
func (*ClassicNameServer) Cleanup ¶
func (s *ClassicNameServer) Cleanup() error
Cleanup clears expired items from cache
func (*ClassicNameServer) HandleResponse ¶
func (s *ClassicNameServer) HandleResponse(ctx context.Context, packet *udp_proto.Packet)
HandleResponse handles udp response packet from remote DNS server.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the interface for DNS client.
func NewClient ¶
NewClient creates a DNS client managing a name server with client IP, domain rules and expected IPs.
func NewLocalDNSClient ¶
func NewLocalDNSClient() *Client
NewLocalDNSClient creates localdns client object for directly lookup in system DNS.
func (*Client) MatchExpectedIPs ¶
MatchExpectedIPs matches queried domain IPs with expected IPs and returns matched ones.
type Config ¶
type Config struct { // Nameservers used by this DNS. Only traditional UDP servers are support at // the moment. A special value 'localhost' as a domain address can be set to // use DNS on local system. // // Deprecated: Do not use. NameServers []*net.Endpoint `protobuf:"bytes,1,rep,name=NameServers,proto3" json:"NameServers,omitempty"` // NameServer list used by this DNS client. NameServer []*NameServer `protobuf:"bytes,5,rep,name=name_server,json=nameServer,proto3" json:"name_server,omitempty"` // Static hosts. Domain to IP. // Deprecated. Use static_hosts. // // Deprecated: Do not use. Hosts map[string]*net.IPOrDomain `` /* 151-byte string literal not displayed */ // Client IP for EDNS client subnet. Must be 4 bytes (IPv4) or 16 bytes // (IPv6). ClientIp []byte `protobuf:"bytes,3,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"` // Static domain-ip mapping in DNS server. StaticHosts []*HostMapping `protobuf:"bytes,4,rep,name=static_hosts,json=staticHosts,proto3" json:"static_hosts,omitempty"` // Global fakedns object. FakeDns *fakedns.FakeDnsPoolMulti `protobuf:"bytes,16,opt,name=fake_dns,json=fakeDns,proto3" json:"fake_dns,omitempty"` // Tag is the inbound tag of DNS client. Tag string `protobuf:"bytes,6,opt,name=tag,proto3" json:"tag,omitempty"` // Domain matcher to use DomainMatcher string `protobuf:"bytes,15,opt,name=domain_matcher,json=domainMatcher,proto3" json:"domain_matcher,omitempty"` // DisableCache disables DNS cache // Deprecated. Use cache_strategy. // // Deprecated: Do not use. DisableCache bool `protobuf:"varint,8,opt,name=disableCache,proto3" json:"disableCache,omitempty"` // Deprecated. Use fallback_strategy. // // Deprecated: Do not use. DisableFallback bool `protobuf:"varint,10,opt,name=disableFallback,proto3" json:"disableFallback,omitempty"` // Deprecated. Use fallback_strategy. // // Deprecated: Do not use. DisableFallbackIfMatch bool `protobuf:"varint,11,opt,name=disableFallbackIfMatch,proto3" json:"disableFallbackIfMatch,omitempty"` // Default query strategy (IPv4, IPv6, or both) for each name server. QueryStrategy QueryStrategy `` /* 139-byte string literal not displayed */ // Default cache strategy for each name server. CacheStrategy CacheStrategy `` /* 140-byte string literal not displayed */ // Default fallback strategy for each name server. FallbackStrategy FallbackStrategy `` /* 152-byte string literal not displayed */ // contains filtered or unexported fields }
func (*Config) Descriptor
deprecated
func (*Config) GetCacheStrategy ¶
func (x *Config) GetCacheStrategy() CacheStrategy
func (*Config) GetClientIp ¶
func (*Config) GetDisableCache
deprecated
func (*Config) GetDisableFallback
deprecated
func (*Config) GetDisableFallbackIfMatch
deprecated
func (*Config) GetDomainMatcher ¶
func (*Config) GetFakeDns ¶
func (x *Config) GetFakeDns() *fakedns.FakeDnsPoolMulti
func (*Config) GetFallbackStrategy ¶
func (x *Config) GetFallbackStrategy() FallbackStrategy
func (*Config) GetHosts
deprecated
func (x *Config) GetHosts() map[string]*net.IPOrDomain
Deprecated: Do not use.
func (*Config) GetNameServer ¶
func (x *Config) GetNameServer() []*NameServer
func (*Config) GetNameServers
deprecated
func (*Config) GetQueryStrategy ¶
func (x *Config) GetQueryStrategy() QueryStrategy
func (*Config) GetStaticHosts ¶
func (x *Config) GetStaticHosts() []*HostMapping
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) ProtoReflect ¶
func (x *Config) ProtoReflect() protoreflect.Message
type DNS ¶
DNS is a DNS rely server.
func (*DNS) AsFakeDNSClient ¶
AsFakeDNSClient implements dns.ClientWithFakeDNS.
func (*DNS) AsFakeDNSEngine ¶
func (s *DNS) AsFakeDNSEngine() dns.FakeDNSEngine
AsFakeDNSEngine implements dns.ClientWithFakeDNS.
func (*DNS) LookupIPv4 ¶
LookupIPv4 implements dns.IPv4Lookup.
func (*DNS) LookupIPv6 ¶
LookupIPv6 implements dns.IPv6Lookup.
type DoHNameServer ¶
DoHNameServer implemented DNS over HTTPS (RFC8484) Wire Format, which is compatible with traditional dns over udp(RFC1035), thus most of the DOH implementation is copied from udpns.go
func NewDoHLocalNameServer ¶
func NewDoHLocalNameServer(url *url.URL) *DoHNameServer
NewDoHLocalNameServer creates DOH client object for local resolving
func NewDoHNameServer ¶
func NewDoHNameServer(url *url.URL, dispatcher routing.Dispatcher) (*DoHNameServer, error)
NewDoHNameServer creates DOH server object for remote resolving.
func (*DoHNameServer) Cleanup ¶
func (s *DoHNameServer) Cleanup() error
Cleanup clears expired items from cache
type DomainMatcherInfo ¶
type DomainMatcherInfo struct {
// contains filtered or unexported fields
}
DomainMatcherInfo contains information attached to index returned by Server.domainMatcher
type DomainMatchingType ¶
type DomainMatchingType int32
const ( DomainMatchingType_Full DomainMatchingType = 0 DomainMatchingType_Subdomain DomainMatchingType = 1 DomainMatchingType_Keyword DomainMatchingType = 2 DomainMatchingType_Regex DomainMatchingType = 3 )
func (DomainMatchingType) Descriptor ¶
func (DomainMatchingType) Descriptor() protoreflect.EnumDescriptor
func (DomainMatchingType) Enum ¶
func (x DomainMatchingType) Enum() *DomainMatchingType
func (DomainMatchingType) EnumDescriptor
deprecated
func (DomainMatchingType) EnumDescriptor() ([]byte, []int)
Deprecated: Use DomainMatchingType.Descriptor instead.
func (DomainMatchingType) Number ¶
func (x DomainMatchingType) Number() protoreflect.EnumNumber
func (DomainMatchingType) String ¶
func (x DomainMatchingType) String() string
func (DomainMatchingType) Type ¶
func (DomainMatchingType) Type() protoreflect.EnumType
type FakeDNSClient ¶
type FakeDNSClient struct {
*DNS
}
FakeDNSClient is an implementation of dns.Client with FakeDNS enabled.
func (*FakeDNSClient) LookupIP ¶
func (s *FakeDNSClient) LookupIP(domain string) ([]net.IP, error)
LookupIP implements dns.Client.
func (*FakeDNSClient) LookupIPv4 ¶
func (s *FakeDNSClient) LookupIPv4(domain string) ([]net.IP, error)
LookupIPv4 implements dns.IPv4Lookup.
func (*FakeDNSClient) LookupIPv6 ¶
func (s *FakeDNSClient) LookupIPv6(domain string) ([]net.IP, error)
LookupIPv6 implements dns.IPv6Lookup.
type FakeDNSEngine ¶
type FakeDNSEngine struct {
// contains filtered or unexported fields
}
FakeDNSEngine is an implementation of dns.FakeDNSEngine based on a fully functional DNS.
func (*FakeDNSEngine) Close ¶
func (f *FakeDNSEngine) Close() error
Close implements common.Closable.
func (*FakeDNSEngine) GetDomainFromFakeDNS ¶
func (f *FakeDNSEngine) GetDomainFromFakeDNS(ip net.Address) string
GetDomainFromFakeDNS implements dns.FakeDNSEngine.
func (*FakeDNSEngine) GetFakeIPForDomain ¶
func (f *FakeDNSEngine) GetFakeIPForDomain(domain string) []net.Address
GetFakeIPForDomain implements dns.FakeDNSEngine.
func (*FakeDNSEngine) GetFakeIPForDomain3 ¶
GetFakeIPForDomain3 implements dns.FakeDNSEngineRev0.
func (*FakeDNSEngine) IsIPInIPPool ¶
func (f *FakeDNSEngine) IsIPInIPPool(ip net.Address) bool
IsIPInIPPool implements dns.FakeDNSEngineRev0.
func (*FakeDNSEngine) Start ¶
func (f *FakeDNSEngine) Start() error
Start implements common.Runnable.
func (*FakeDNSEngine) Type ¶
func (*FakeDNSEngine) Type() interface{}
Type implements common.HasType.
type FakeDNSServer ¶
type FakeDNSServer struct {
// contains filtered or unexported fields
}
func NewFakeDNSServer ¶
func NewFakeDNSServer(fakeDNSEngine dns.FakeDNSEngine) *FakeDNSServer
func (FakeDNSServer) Name ¶
func (FakeDNSServer) Name() string
type FallbackStrategy ¶
type FallbackStrategy int32
const ( FallbackStrategy_Enabled FallbackStrategy = 0 FallbackStrategy_Disabled FallbackStrategy = 1 FallbackStrategy_DisabledIfAnyMatch FallbackStrategy = 2 )
func (FallbackStrategy) Descriptor ¶
func (FallbackStrategy) Descriptor() protoreflect.EnumDescriptor
func (FallbackStrategy) Enum ¶
func (x FallbackStrategy) Enum() *FallbackStrategy
func (FallbackStrategy) EnumDescriptor
deprecated
func (FallbackStrategy) EnumDescriptor() ([]byte, []int)
Deprecated: Use FallbackStrategy.Descriptor instead.
func (FallbackStrategy) Number ¶
func (x FallbackStrategy) Number() protoreflect.EnumNumber
func (FallbackStrategy) String ¶
func (x FallbackStrategy) String() string
func (FallbackStrategy) Type ¶
func (FallbackStrategy) Type() protoreflect.EnumType
type HostMapping ¶
type HostMapping struct { Type DomainMatchingType `protobuf:"varint,1,opt,name=type,proto3,enum=v2ray.core.app.dns.DomainMatchingType" json:"type,omitempty"` Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"` Ip [][]byte `protobuf:"bytes,3,rep,name=ip,proto3" json:"ip,omitempty"` // ProxiedDomain indicates the mapped domain has the same IP address on this // domain. V2Ray will use this domain for IP queries. ProxiedDomain string `protobuf:"bytes,4,opt,name=proxied_domain,json=proxiedDomain,proto3" json:"proxied_domain,omitempty"` // contains filtered or unexported fields }
func (*HostMapping) Descriptor
deprecated
func (*HostMapping) Descriptor() ([]byte, []int)
Deprecated: Use HostMapping.ProtoReflect.Descriptor instead.
func (*HostMapping) GetDomain ¶
func (x *HostMapping) GetDomain() string
func (*HostMapping) GetIp ¶
func (x *HostMapping) GetIp() [][]byte
func (*HostMapping) GetProxiedDomain ¶
func (x *HostMapping) GetProxiedDomain() string
func (*HostMapping) GetType ¶
func (x *HostMapping) GetType() DomainMatchingType
func (*HostMapping) ProtoMessage ¶
func (*HostMapping) ProtoMessage()
func (*HostMapping) ProtoReflect ¶
func (x *HostMapping) ProtoReflect() protoreflect.Message
func (*HostMapping) Reset ¶
func (x *HostMapping) Reset()
func (*HostMapping) String ¶
func (x *HostMapping) String() string
type LocalNameServer ¶
type LocalNameServer struct {
// contains filtered or unexported fields
}
LocalNameServer is an wrapper over local DNS feature.
func NewLocalNameServer ¶
func NewLocalNameServer() *LocalNameServer
NewLocalNameServer creates localdns server object for directly lookup in system DNS.
type NameServer ¶
type NameServer struct { Address *net.Endpoint `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` ClientIp []byte `protobuf:"bytes,5,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"` Tag string `protobuf:"bytes,7,opt,name=tag,proto3" json:"tag,omitempty"` PrioritizedDomain []*NameServer_PriorityDomain `protobuf:"bytes,2,rep,name=prioritized_domain,json=prioritizedDomain,proto3" json:"prioritized_domain,omitempty"` Geoip []*routercommon.GeoIP `protobuf:"bytes,3,rep,name=geoip,proto3" json:"geoip,omitempty"` OriginalRules []*NameServer_OriginalRule `protobuf:"bytes,4,rep,name=original_rules,json=originalRules,proto3" json:"original_rules,omitempty"` FakeDns *fakedns.FakeDnsPoolMulti `protobuf:"bytes,11,opt,name=fake_dns,json=fakeDns,proto3" json:"fake_dns,omitempty"` // Deprecated. Use fallback_strategy. // // Deprecated: Do not use. SkipFallback bool `protobuf:"varint,6,opt,name=skipFallback,proto3" json:"skipFallback,omitempty"` QueryStrategy *QueryStrategy `` /* 145-byte string literal not displayed */ CacheStrategy *CacheStrategy `` /* 145-byte string literal not displayed */ FallbackStrategy *FallbackStrategy `` /* 158-byte string literal not displayed */ // contains filtered or unexported fields }
func (*NameServer) Descriptor
deprecated
func (*NameServer) Descriptor() ([]byte, []int)
Deprecated: Use NameServer.ProtoReflect.Descriptor instead.
func (*NameServer) GetAddress ¶
func (x *NameServer) GetAddress() *net.Endpoint
func (*NameServer) GetCacheStrategy ¶
func (x *NameServer) GetCacheStrategy() CacheStrategy
func (*NameServer) GetClientIp ¶
func (x *NameServer) GetClientIp() []byte
func (*NameServer) GetFakeDns ¶
func (x *NameServer) GetFakeDns() *fakedns.FakeDnsPoolMulti
func (*NameServer) GetFallbackStrategy ¶
func (x *NameServer) GetFallbackStrategy() FallbackStrategy
func (*NameServer) GetGeoip ¶
func (x *NameServer) GetGeoip() []*routercommon.GeoIP
func (*NameServer) GetOriginalRules ¶
func (x *NameServer) GetOriginalRules() []*NameServer_OriginalRule
func (*NameServer) GetPrioritizedDomain ¶
func (x *NameServer) GetPrioritizedDomain() []*NameServer_PriorityDomain
func (*NameServer) GetQueryStrategy ¶
func (x *NameServer) GetQueryStrategy() QueryStrategy
func (*NameServer) GetSkipFallback
deprecated
func (x *NameServer) GetSkipFallback() bool
Deprecated: Do not use.
func (*NameServer) GetTag ¶
func (x *NameServer) GetTag() string
func (*NameServer) ProtoMessage ¶
func (*NameServer) ProtoMessage()
func (*NameServer) ProtoReflect ¶
func (x *NameServer) ProtoReflect() protoreflect.Message
func (*NameServer) Reset ¶
func (x *NameServer) Reset()
func (*NameServer) String ¶
func (x *NameServer) String() string
type NameServer_OriginalRule ¶
type NameServer_OriginalRule struct { Rule string `protobuf:"bytes,1,opt,name=rule,proto3" json:"rule,omitempty"` Size uint32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` // contains filtered or unexported fields }
func (*NameServer_OriginalRule) Descriptor
deprecated
func (*NameServer_OriginalRule) Descriptor() ([]byte, []int)
Deprecated: Use NameServer_OriginalRule.ProtoReflect.Descriptor instead.
func (*NameServer_OriginalRule) GetRule ¶
func (x *NameServer_OriginalRule) GetRule() string
func (*NameServer_OriginalRule) GetSize ¶
func (x *NameServer_OriginalRule) GetSize() uint32
func (*NameServer_OriginalRule) ProtoMessage ¶
func (*NameServer_OriginalRule) ProtoMessage()
func (*NameServer_OriginalRule) ProtoReflect ¶
func (x *NameServer_OriginalRule) ProtoReflect() protoreflect.Message
func (*NameServer_OriginalRule) Reset ¶
func (x *NameServer_OriginalRule) Reset()
func (*NameServer_OriginalRule) String ¶
func (x *NameServer_OriginalRule) String() string
type NameServer_PriorityDomain ¶
type NameServer_PriorityDomain struct { Type DomainMatchingType `protobuf:"varint,1,opt,name=type,proto3,enum=v2ray.core.app.dns.DomainMatchingType" json:"type,omitempty"` Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"` // contains filtered or unexported fields }
func (*NameServer_PriorityDomain) Descriptor
deprecated
func (*NameServer_PriorityDomain) Descriptor() ([]byte, []int)
Deprecated: Use NameServer_PriorityDomain.ProtoReflect.Descriptor instead.
func (*NameServer_PriorityDomain) GetDomain ¶
func (x *NameServer_PriorityDomain) GetDomain() string
func (*NameServer_PriorityDomain) GetType ¶
func (x *NameServer_PriorityDomain) GetType() DomainMatchingType
func (*NameServer_PriorityDomain) ProtoMessage ¶
func (*NameServer_PriorityDomain) ProtoMessage()
func (*NameServer_PriorityDomain) ProtoReflect ¶
func (x *NameServer_PriorityDomain) ProtoReflect() protoreflect.Message
func (*NameServer_PriorityDomain) Reset ¶
func (x *NameServer_PriorityDomain) Reset()
func (*NameServer_PriorityDomain) String ¶
func (x *NameServer_PriorityDomain) String() string
type QUICNameServer ¶
QUICNameServer implemented DNS over QUIC
func NewQUICNameServer ¶
func NewQUICNameServer(url *url.URL) (*QUICNameServer, error)
NewQUICNameServer creates DNS-over-QUIC client object for local resolving
func (*QUICNameServer) Cleanup ¶
func (s *QUICNameServer) Cleanup() error
Cleanup clears expired items from cache
type QueryStrategy ¶
type QueryStrategy int32
const ( QueryStrategy_USE_IP QueryStrategy = 0 QueryStrategy_USE_IP4 QueryStrategy = 1 QueryStrategy_USE_IP6 QueryStrategy = 2 )
func (QueryStrategy) Descriptor ¶
func (QueryStrategy) Descriptor() protoreflect.EnumDescriptor
func (QueryStrategy) Enum ¶
func (x QueryStrategy) Enum() *QueryStrategy
func (QueryStrategy) EnumDescriptor
deprecated
func (QueryStrategy) EnumDescriptor() ([]byte, []int)
Deprecated: Use QueryStrategy.Descriptor instead.
func (QueryStrategy) Number ¶
func (x QueryStrategy) Number() protoreflect.EnumNumber
func (QueryStrategy) String ¶
func (x QueryStrategy) String() string
func (QueryStrategy) Type ¶
func (QueryStrategy) Type() protoreflect.EnumType
type Server ¶
type Server interface { // Name of the Client. Name() string // QueryIP sends IP queries to its configured server. QueryIP(ctx context.Context, domain string, clientIP net.IP, option dns.IPOption, disableCache bool) ([]net.IP, error) }
Server is the interface for Name Server.
type SimplifiedConfig ¶
type SimplifiedConfig struct { // NameServer list used by this DNS client. NameServer []*SimplifiedNameServer `protobuf:"bytes,5,rep,name=name_server,json=nameServer,proto3" json:"name_server,omitempty"` // Client IP for EDNS client subnet. Must be 4 bytes (IPv4) or 16 bytes // (IPv6). ClientIp string `protobuf:"bytes,3,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"` // Static domain-ip mapping in DNS server. StaticHosts []*SimplifiedHostMapping `protobuf:"bytes,4,rep,name=static_hosts,json=staticHosts,proto3" json:"static_hosts,omitempty"` // Global fakedns object. FakeDns *fakedns.FakeDnsPoolMulti `protobuf:"bytes,16,opt,name=fake_dns,json=fakeDns,proto3" json:"fake_dns,omitempty"` // Tag is the inbound tag of DNS client. Tag string `protobuf:"bytes,6,opt,name=tag,proto3" json:"tag,omitempty"` // Domain matcher to use DomainMatcher string `protobuf:"bytes,15,opt,name=domain_matcher,json=domainMatcher,proto3" json:"domain_matcher,omitempty"` // DisableCache disables DNS cache // Deprecated. Use cache_strategy. // // Deprecated: Do not use. DisableCache bool `protobuf:"varint,8,opt,name=disableCache,proto3" json:"disableCache,omitempty"` // Deprecated. Use fallback_strategy. // // Deprecated: Do not use. DisableFallback bool `protobuf:"varint,10,opt,name=disableFallback,proto3" json:"disableFallback,omitempty"` // Deprecated. Use fallback_strategy. // // Deprecated: Do not use. DisableFallbackIfMatch bool `protobuf:"varint,11,opt,name=disableFallbackIfMatch,proto3" json:"disableFallbackIfMatch,omitempty"` // Default query strategy (IPv4, IPv6, or both) for each name server. QueryStrategy QueryStrategy `` /* 139-byte string literal not displayed */ // Default cache strategy for each name server. CacheStrategy CacheStrategy `` /* 140-byte string literal not displayed */ // Default fallback strategy for each name server. FallbackStrategy FallbackStrategy `` /* 152-byte string literal not displayed */ // contains filtered or unexported fields }
func (*SimplifiedConfig) Descriptor
deprecated
func (*SimplifiedConfig) Descriptor() ([]byte, []int)
Deprecated: Use SimplifiedConfig.ProtoReflect.Descriptor instead.
func (*SimplifiedConfig) GetCacheStrategy ¶
func (x *SimplifiedConfig) GetCacheStrategy() CacheStrategy
func (*SimplifiedConfig) GetClientIp ¶
func (x *SimplifiedConfig) GetClientIp() string
func (*SimplifiedConfig) GetDisableCache
deprecated
func (x *SimplifiedConfig) GetDisableCache() bool
Deprecated: Do not use.
func (*SimplifiedConfig) GetDisableFallback
deprecated
func (x *SimplifiedConfig) GetDisableFallback() bool
Deprecated: Do not use.
func (*SimplifiedConfig) GetDisableFallbackIfMatch
deprecated
func (x *SimplifiedConfig) GetDisableFallbackIfMatch() bool
Deprecated: Do not use.
func (*SimplifiedConfig) GetDomainMatcher ¶
func (x *SimplifiedConfig) GetDomainMatcher() string
func (*SimplifiedConfig) GetFakeDns ¶
func (x *SimplifiedConfig) GetFakeDns() *fakedns.FakeDnsPoolMulti
func (*SimplifiedConfig) GetFallbackStrategy ¶
func (x *SimplifiedConfig) GetFallbackStrategy() FallbackStrategy
func (*SimplifiedConfig) GetNameServer ¶
func (x *SimplifiedConfig) GetNameServer() []*SimplifiedNameServer
func (*SimplifiedConfig) GetQueryStrategy ¶
func (x *SimplifiedConfig) GetQueryStrategy() QueryStrategy
func (*SimplifiedConfig) GetStaticHosts ¶
func (x *SimplifiedConfig) GetStaticHosts() []*SimplifiedHostMapping
func (*SimplifiedConfig) GetTag ¶
func (x *SimplifiedConfig) GetTag() string
func (*SimplifiedConfig) ProtoMessage ¶
func (*SimplifiedConfig) ProtoMessage()
func (*SimplifiedConfig) ProtoReflect ¶
func (x *SimplifiedConfig) ProtoReflect() protoreflect.Message
func (*SimplifiedConfig) Reset ¶
func (x *SimplifiedConfig) Reset()
func (*SimplifiedConfig) String ¶
func (x *SimplifiedConfig) String() string
type SimplifiedHostMapping ¶
type SimplifiedHostMapping struct { Type DomainMatchingType `protobuf:"varint,1,opt,name=type,proto3,enum=v2ray.core.app.dns.DomainMatchingType" json:"type,omitempty"` Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"` Ip []string `protobuf:"bytes,3,rep,name=ip,proto3" json:"ip,omitempty"` // ProxiedDomain indicates the mapped domain has the same IP address on this // domain. V2Ray will use this domain for IP queries. ProxiedDomain string `protobuf:"bytes,4,opt,name=proxied_domain,json=proxiedDomain,proto3" json:"proxied_domain,omitempty"` // contains filtered or unexported fields }
func (*SimplifiedHostMapping) Descriptor
deprecated
func (*SimplifiedHostMapping) Descriptor() ([]byte, []int)
Deprecated: Use SimplifiedHostMapping.ProtoReflect.Descriptor instead.
func (*SimplifiedHostMapping) GetDomain ¶
func (x *SimplifiedHostMapping) GetDomain() string
func (*SimplifiedHostMapping) GetIp ¶
func (x *SimplifiedHostMapping) GetIp() []string
func (*SimplifiedHostMapping) GetProxiedDomain ¶
func (x *SimplifiedHostMapping) GetProxiedDomain() string
func (*SimplifiedHostMapping) GetType ¶
func (x *SimplifiedHostMapping) GetType() DomainMatchingType
func (*SimplifiedHostMapping) ProtoMessage ¶
func (*SimplifiedHostMapping) ProtoMessage()
func (*SimplifiedHostMapping) ProtoReflect ¶
func (x *SimplifiedHostMapping) ProtoReflect() protoreflect.Message
func (*SimplifiedHostMapping) Reset ¶
func (x *SimplifiedHostMapping) Reset()
func (*SimplifiedHostMapping) String ¶
func (x *SimplifiedHostMapping) String() string
type SimplifiedNameServer ¶
type SimplifiedNameServer struct { Address *net.Endpoint `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` ClientIp string `protobuf:"bytes,5,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"` Tag string `protobuf:"bytes,7,opt,name=tag,proto3" json:"tag,omitempty"` PrioritizedDomain []*SimplifiedNameServer_PriorityDomain `protobuf:"bytes,2,rep,name=prioritized_domain,json=prioritizedDomain,proto3" json:"prioritized_domain,omitempty"` Geoip []*routercommon.GeoIP `protobuf:"bytes,3,rep,name=geoip,proto3" json:"geoip,omitempty"` OriginalRules []*SimplifiedNameServer_OriginalRule `protobuf:"bytes,4,rep,name=original_rules,json=originalRules,proto3" json:"original_rules,omitempty"` FakeDns *fakedns.FakeDnsPoolMulti `protobuf:"bytes,11,opt,name=fake_dns,json=fakeDns,proto3" json:"fake_dns,omitempty"` // Deprecated. Use fallback_strategy. // // Deprecated: Do not use. SkipFallback bool `protobuf:"varint,6,opt,name=skipFallback,proto3" json:"skipFallback,omitempty"` QueryStrategy *QueryStrategy `` /* 145-byte string literal not displayed */ CacheStrategy *CacheStrategy `` /* 145-byte string literal not displayed */ FallbackStrategy *FallbackStrategy `` /* 158-byte string literal not displayed */ // contains filtered or unexported fields }
func (*SimplifiedNameServer) Descriptor
deprecated
func (*SimplifiedNameServer) Descriptor() ([]byte, []int)
Deprecated: Use SimplifiedNameServer.ProtoReflect.Descriptor instead.
func (*SimplifiedNameServer) GetAddress ¶
func (x *SimplifiedNameServer) GetAddress() *net.Endpoint
func (*SimplifiedNameServer) GetCacheStrategy ¶
func (x *SimplifiedNameServer) GetCacheStrategy() CacheStrategy
func (*SimplifiedNameServer) GetClientIp ¶
func (x *SimplifiedNameServer) GetClientIp() string
func (*SimplifiedNameServer) GetFakeDns ¶
func (x *SimplifiedNameServer) GetFakeDns() *fakedns.FakeDnsPoolMulti
func (*SimplifiedNameServer) GetFallbackStrategy ¶
func (x *SimplifiedNameServer) GetFallbackStrategy() FallbackStrategy
func (*SimplifiedNameServer) GetGeoip ¶
func (x *SimplifiedNameServer) GetGeoip() []*routercommon.GeoIP
func (*SimplifiedNameServer) GetOriginalRules ¶
func (x *SimplifiedNameServer) GetOriginalRules() []*SimplifiedNameServer_OriginalRule
func (*SimplifiedNameServer) GetPrioritizedDomain ¶
func (x *SimplifiedNameServer) GetPrioritizedDomain() []*SimplifiedNameServer_PriorityDomain
func (*SimplifiedNameServer) GetQueryStrategy ¶
func (x *SimplifiedNameServer) GetQueryStrategy() QueryStrategy
func (*SimplifiedNameServer) GetSkipFallback
deprecated
func (x *SimplifiedNameServer) GetSkipFallback() bool
Deprecated: Do not use.
func (*SimplifiedNameServer) GetTag ¶
func (x *SimplifiedNameServer) GetTag() string
func (*SimplifiedNameServer) ProtoMessage ¶
func (*SimplifiedNameServer) ProtoMessage()
func (*SimplifiedNameServer) ProtoReflect ¶
func (x *SimplifiedNameServer) ProtoReflect() protoreflect.Message
func (*SimplifiedNameServer) Reset ¶
func (x *SimplifiedNameServer) Reset()
func (*SimplifiedNameServer) String ¶
func (x *SimplifiedNameServer) String() string
type SimplifiedNameServer_OriginalRule ¶
type SimplifiedNameServer_OriginalRule struct { Rule string `protobuf:"bytes,1,opt,name=rule,proto3" json:"rule,omitempty"` Size uint32 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` // contains filtered or unexported fields }
func (*SimplifiedNameServer_OriginalRule) Descriptor
deprecated
func (*SimplifiedNameServer_OriginalRule) Descriptor() ([]byte, []int)
Deprecated: Use SimplifiedNameServer_OriginalRule.ProtoReflect.Descriptor instead.
func (*SimplifiedNameServer_OriginalRule) GetRule ¶
func (x *SimplifiedNameServer_OriginalRule) GetRule() string
func (*SimplifiedNameServer_OriginalRule) GetSize ¶
func (x *SimplifiedNameServer_OriginalRule) GetSize() uint32
func (*SimplifiedNameServer_OriginalRule) ProtoMessage ¶
func (*SimplifiedNameServer_OriginalRule) ProtoMessage()
func (*SimplifiedNameServer_OriginalRule) ProtoReflect ¶
func (x *SimplifiedNameServer_OriginalRule) ProtoReflect() protoreflect.Message
func (*SimplifiedNameServer_OriginalRule) Reset ¶
func (x *SimplifiedNameServer_OriginalRule) Reset()
func (*SimplifiedNameServer_OriginalRule) String ¶
func (x *SimplifiedNameServer_OriginalRule) String() string
type SimplifiedNameServer_PriorityDomain ¶
type SimplifiedNameServer_PriorityDomain struct { Type DomainMatchingType `protobuf:"varint,1,opt,name=type,proto3,enum=v2ray.core.app.dns.DomainMatchingType" json:"type,omitempty"` Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"` // contains filtered or unexported fields }
func (*SimplifiedNameServer_PriorityDomain) Descriptor
deprecated
func (*SimplifiedNameServer_PriorityDomain) Descriptor() ([]byte, []int)
Deprecated: Use SimplifiedNameServer_PriorityDomain.ProtoReflect.Descriptor instead.
func (*SimplifiedNameServer_PriorityDomain) GetDomain ¶
func (x *SimplifiedNameServer_PriorityDomain) GetDomain() string
func (*SimplifiedNameServer_PriorityDomain) GetType ¶
func (x *SimplifiedNameServer_PriorityDomain) GetType() DomainMatchingType
func (*SimplifiedNameServer_PriorityDomain) ProtoMessage ¶
func (*SimplifiedNameServer_PriorityDomain) ProtoMessage()
func (*SimplifiedNameServer_PriorityDomain) ProtoReflect ¶
func (x *SimplifiedNameServer_PriorityDomain) ProtoReflect() protoreflect.Message
func (*SimplifiedNameServer_PriorityDomain) Reset ¶
func (x *SimplifiedNameServer_PriorityDomain) Reset()
func (*SimplifiedNameServer_PriorityDomain) String ¶
func (x *SimplifiedNameServer_PriorityDomain) String() string
type StaticHosts ¶
type StaticHosts struct {
// contains filtered or unexported fields
}
StaticHosts represents static domain-ip mapping in DNS server.
func NewStaticHosts ¶
func NewStaticHosts(hosts []*HostMapping, legacy map[string]*net.IPOrDomain) (*StaticHosts, error)
NewStaticHosts creates a new StaticHosts instance.
type TCPNameServer ¶
TCPNameServer implemented DNS over TCP (RFC7766).
func NewTCPLocalNameServer ¶
func NewTCPLocalNameServer(url *url.URL) (*TCPNameServer, error)
NewTCPLocalNameServer creates DNS over TCP client object for local resolving
func NewTCPNameServer ¶
func NewTCPNameServer(url *url.URL, dispatcher routing.Dispatcher) (*TCPNameServer, error)
NewTCPNameServer creates DNS over TCP server object for remote resolving.
func (*TCPNameServer) Cleanup ¶
func (s *TCPNameServer) Cleanup() error
Cleanup clears expired items from cache