dns

package
v1.260206.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2026 License: MPL-2.0 Imports: 52 Imported by: 68

Documentation

Overview

Package dns is an implementation of core.DNS feature.

Index

Constants

View Source
const NextProtoDQ = "doq"

NextProtoDQ - During connection establishment, DNS/QUIC support is indicated by selecting the ALPN token "dq" in the crypto handshake.

Variables

View Source
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.

View Source
var (
	QueryStrategy_name = map[int32]string{
		0: "USE_IP",
		1: "USE_IP4",
		2: "USE_IP6",
		3: "USE_SYS",
	}
	QueryStrategy_value = map[string]int32{
		"USE_IP":  0,
		"USE_IP4": 1,
		"USE_IP6": 2,
		"USE_SYS": 3,
	}
)

Enum value maps for QueryStrategy.

View Source
var File_app_dns_config_proto protoreflect.FileDescriptor

Functions

func Fqdn

func Fqdn(domain string) string

Fqdn normalizes domain make sure it ends with '.' case-sensitive

func ResolveIpOptionOverride added in v1.8.5

func ResolveIpOptionOverride(queryStrategy QueryStrategy, ipOption dns.IPOption) dns.IPOption

Types

type CacheController added in v1.250516.0

type CacheController struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCacheController added in v1.250516.0

func NewCacheController(name string, disableCache bool, serveStale bool, serveExpiredTTL uint32) *CacheController

func (*CacheController) CacheCleanup added in v1.250516.0

func (c *CacheController) CacheCleanup() error

CacheCleanup clears expired items from cache

type CachedNameserver added in v1.251201.0

type CachedNameserver interface {
	// contains filtered or unexported methods
}

type ClassicNameServer

type ClassicNameServer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ClassicNameServer implemented traditional UDP DNS.

func NewClassicNameServer

func NewClassicNameServer(address net.Destination, dispatcher routing.Dispatcher, disableCache bool, serveStale bool, serveExpiredTTL uint32, clientIP net.IP) *ClassicNameServer

NewClassicNameServer creates udp server object for remote resolving.

func (*ClassicNameServer) HandleResponse

func (s *ClassicNameServer) HandleResponse(ctx context.Context, packet *udp_proto.Packet)

HandleResponse handles udp response packet from remote DNS server.

func (*ClassicNameServer) IsDisableCache added in v1.251201.0

func (s *ClassicNameServer) IsDisableCache() bool

IsDisableCache implements Server.

func (*ClassicNameServer) Name

func (s *ClassicNameServer) Name() string

Name implements Server.

func (*ClassicNameServer) QueryIP

func (s *ClassicNameServer) QueryIP(ctx context.Context, domain string, option dns_feature.IPOption) ([]net.IP, uint32, error)

QueryIP implements Server.

func (*ClassicNameServer) RequestsCleanup added in v1.250516.0

func (s *ClassicNameServer) RequestsCleanup() error

RequestsCleanup clears expired items from cache

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the interface for DNS client.

func NewClient added in v1.5.0

func NewClient(
	ctx context.Context,
	ns *NameServer,
	clientIP net.IP,
	disableCache bool, serveStale bool, serveExpiredTTL uint32,
	tag string,
	ipOption dns.IPOption,
	matcherInfos *[]*DomainMatcherInfo,
	updateDomainRule func(strmatcher.Matcher, int, []*DomainMatcherInfo),
) (*Client, error)

NewClient creates a DNS client managing a name server with client IP, domain rules and expected IPs.

func NewLocalDNSClient added in v1.5.0

func NewLocalDNSClient(ipOption dns.IPOption) *Client

NewLocalDNSClient creates localdns client object for directly lookup in system DNS.

func (*Client) Name

func (c *Client) Name() string

Name returns the server name the client manages.

func (*Client) QueryIP

func (c *Client) QueryIP(ctx context.Context, domain string, option dns.IPOption) ([]net.IP, uint32, error)

QueryIP sends DNS query to the name server with the client's IP.

type Config

type Config struct {

	// NameServer list used by this DNS client.
	// A special value 'localhost' as a domain address can be set to use DNS on local system.
	NameServer []*NameServer `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    []byte                `protobuf:"bytes,3,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"`
	StaticHosts []*Config_HostMapping `protobuf:"bytes,4,rep,name=static_hosts,json=staticHosts,proto3" json:"static_hosts,omitempty"`
	// Tag is the inbound tag of DNS client.
	Tag string `protobuf:"bytes,6,opt,name=tag,proto3" json:"tag,omitempty"`
	// DisableCache disables DNS cache
	DisableCache           bool          `protobuf:"varint,8,opt,name=disableCache,proto3" json:"disableCache,omitempty"`
	ServeStale             bool          `protobuf:"varint,12,opt,name=serveStale,proto3" json:"serveStale,omitempty"`
	ServeExpiredTTL        uint32        `protobuf:"varint,13,opt,name=serveExpiredTTL,proto3" json:"serveExpiredTTL,omitempty"`
	QueryStrategy          QueryStrategy `` /* 133-byte string literal not displayed */
	DisableFallback        bool          `protobuf:"varint,10,opt,name=disableFallback,proto3" json:"disableFallback,omitempty"`
	DisableFallbackIfMatch bool          `protobuf:"varint,11,opt,name=disableFallbackIfMatch,proto3" json:"disableFallbackIfMatch,omitempty"`
	EnableParallelQuery    bool          `protobuf:"varint,14,opt,name=enableParallelQuery,proto3" json:"enableParallelQuery,omitempty"`
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetClientIp

func (x *Config) GetClientIp() []byte

func (*Config) GetDisableCache added in v1.5.0

func (x *Config) GetDisableCache() bool

func (*Config) GetDisableFallback added in v1.5.0

func (x *Config) GetDisableFallback() bool

func (*Config) GetDisableFallbackIfMatch added in v1.5.0

func (x *Config) GetDisableFallbackIfMatch() bool

func (*Config) GetEnableParallelQuery added in v1.251201.0

func (x *Config) GetEnableParallelQuery() bool

func (*Config) GetNameServer

func (x *Config) GetNameServer() []*NameServer

func (*Config) GetQueryStrategy added in v1.5.0

func (x *Config) GetQueryStrategy() QueryStrategy

func (*Config) GetServeExpiredTTL added in v1.251201.0

func (x *Config) GetServeExpiredTTL() uint32

func (*Config) GetServeStale added in v1.251201.0

func (x *Config) GetServeStale() bool

func (*Config) GetStaticHosts

func (x *Config) GetStaticHosts() []*Config_HostMapping

func (*Config) GetTag

func (x *Config) GetTag() string

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type Config_HostMapping

type Config_HostMapping struct {
	Type   DomainMatchingType `protobuf:"varint,1,opt,name=type,proto3,enum=xray.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. Xray 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 (*Config_HostMapping) Descriptor deprecated

func (*Config_HostMapping) Descriptor() ([]byte, []int)

Deprecated: Use Config_HostMapping.ProtoReflect.Descriptor instead.

func (*Config_HostMapping) GetDomain

func (x *Config_HostMapping) GetDomain() string

func (*Config_HostMapping) GetIp

func (x *Config_HostMapping) GetIp() [][]byte

func (*Config_HostMapping) GetProxiedDomain

func (x *Config_HostMapping) GetProxiedDomain() string

func (*Config_HostMapping) GetType

func (*Config_HostMapping) ProtoMessage

func (*Config_HostMapping) ProtoMessage()

func (*Config_HostMapping) ProtoReflect

func (x *Config_HostMapping) ProtoReflect() protoreflect.Message

func (*Config_HostMapping) Reset

func (x *Config_HostMapping) Reset()

func (*Config_HostMapping) String

func (x *Config_HostMapping) String() string

type DNS added in v1.5.0

type DNS struct {
	sync.Mutex
	// contains filtered or unexported fields
}

DNS is a DNS rely server.

func New

func New(ctx context.Context, config *Config) (*DNS, error)

New creates a new DNS server with given configuration.

func (*DNS) Close added in v1.5.0

func (s *DNS) Close() error

Close implements common.Closable.

func (s *DNS) IsOwnLink(ctx context.Context) bool

IsOwnLink implements proxy.dns.ownLinkVerifier

func (*DNS) LookupIP added in v1.5.0

func (s *DNS) LookupIP(domain string, option dns.IPOption) ([]net.IP, uint32, error)

LookupIP implements dns.Client.

func (*DNS) Start added in v1.5.0

func (s *DNS) Start() error

Start implements common.Runnable.

func (*DNS) Type added in v1.5.0

func (*DNS) Type() interface{}

Type implements common.HasType.

type DoHNameServer

type DoHNameServer struct {
	// contains filtered or unexported fields
}

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 NewDoHNameServer

func NewDoHNameServer(url *url.URL, dispatcher routing.Dispatcher, h2c bool, disableCache bool, serveStale bool, serveExpiredTTL uint32, clientIP net.IP) *DoHNameServer

NewDoHNameServer creates DOH/DOHL client object for remote/local resolving.

func (*DoHNameServer) IsDisableCache added in v1.251201.0

func (s *DoHNameServer) IsDisableCache() bool

IsDisableCache implements Server.

func (*DoHNameServer) Name

func (s *DoHNameServer) Name() string

Name implements Server.

func (*DoHNameServer) QueryIP

func (s *DoHNameServer) QueryIP(ctx context.Context, domain string, option dns_feature.IPOption) ([]net.IP, uint32, error)

QueryIP implements Server.

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) Enum

func (DomainMatchingType) EnumDescriptor deprecated

func (DomainMatchingType) EnumDescriptor() ([]byte, []int)

Deprecated: Use DomainMatchingType.Descriptor instead.

func (DomainMatchingType) Number

func (DomainMatchingType) String

func (x DomainMatchingType) String() string

func (DomainMatchingType) Type

type FakeDNSServer added in v1.4.0

type FakeDNSServer struct {
	// contains filtered or unexported fields
}

func NewFakeDNSServer added in v1.4.0

func NewFakeDNSServer(fd dns.FakeDNSEngine) *FakeDNSServer

func (*FakeDNSServer) IsDisableCache added in v1.251201.0

func (s *FakeDNSServer) IsDisableCache() bool

IsDisableCache implements Server.

func (FakeDNSServer) Name added in v1.4.0

func (FakeDNSServer) Name() string

func (*FakeDNSServer) QueryIP added in v1.4.0

func (f *FakeDNSServer) QueryIP(ctx context.Context, domain string, opt dns.IPOption) ([]net.IP, uint32, error)

type IPRecord

type IPRecord struct {
	ReqID     uint16
	IP        []net.IP
	Expire    time.Time
	RCode     dnsmessage.RCode
	RawHeader *dnsmessage.Header
}

IPRecord is a cacheable item for a resolved domain

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.

func (*LocalNameServer) IsDisableCache added in v1.251201.0

func (s *LocalNameServer) IsDisableCache() bool

IsDisableCache implements Server.

func (*LocalNameServer) Name

func (s *LocalNameServer) Name() string

Name implements Server.

func (*LocalNameServer) QueryIP

func (s *LocalNameServer) QueryIP(ctx context.Context, domain string, option dns.IPOption) (ips []net.IP, ttl uint32, err error)

QueryIP implements Server.

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"`
	SkipFallback      bool                         `protobuf:"varint,6,opt,name=skipFallback,proto3" json:"skipFallback,omitempty"`
	PrioritizedDomain []*NameServer_PriorityDomain `protobuf:"bytes,2,rep,name=prioritized_domain,json=prioritizedDomain,proto3" json:"prioritized_domain,omitempty"`
	ExpectedGeoip     []*router.GeoIP              `protobuf:"bytes,3,rep,name=expected_geoip,json=expectedGeoip,proto3" json:"expected_geoip,omitempty"`
	OriginalRules     []*NameServer_OriginalRule   `protobuf:"bytes,4,rep,name=original_rules,json=originalRules,proto3" json:"original_rules,omitempty"`
	QueryStrategy     QueryStrategy                `` /* 133-byte string literal not displayed */
	ActPrior          bool                         `protobuf:"varint,8,opt,name=actPrior,proto3" json:"actPrior,omitempty"`
	Tag               string                       `protobuf:"bytes,9,opt,name=tag,proto3" json:"tag,omitempty"`
	TimeoutMs         uint64                       `protobuf:"varint,10,opt,name=timeoutMs,proto3" json:"timeoutMs,omitempty"`
	DisableCache      *bool                        `protobuf:"varint,11,opt,name=disableCache,proto3,oneof" json:"disableCache,omitempty"`
	ServeStale        *bool                        `protobuf:"varint,15,opt,name=serveStale,proto3,oneof" json:"serveStale,omitempty"`
	ServeExpiredTTL   *uint32                      `protobuf:"varint,16,opt,name=serveExpiredTTL,proto3,oneof" json:"serveExpiredTTL,omitempty"`
	FinalQuery        bool                         `protobuf:"varint,12,opt,name=finalQuery,proto3" json:"finalQuery,omitempty"`
	UnexpectedGeoip   []*router.GeoIP              `protobuf:"bytes,13,rep,name=unexpected_geoip,json=unexpectedGeoip,proto3" json:"unexpected_geoip,omitempty"`
	ActUnprior        bool                         `protobuf:"varint,14,opt,name=actUnprior,proto3" json:"actUnprior,omitempty"`
	PolicyID          uint32                       `protobuf:"varint,17,opt,name=policyID,proto3" json:"policyID,omitempty"`
	// contains filtered or unexported fields
}

func (*NameServer) Descriptor deprecated

func (*NameServer) Descriptor() ([]byte, []int)

Deprecated: Use NameServer.ProtoReflect.Descriptor instead.

func (*NameServer) GetActPrior added in v1.250608.0

func (x *NameServer) GetActPrior() bool

func (*NameServer) GetActUnprior added in v1.250608.0

func (x *NameServer) GetActUnprior() bool

func (*NameServer) GetAddress

func (x *NameServer) GetAddress() *net.Endpoint

func (*NameServer) GetClientIp added in v1.5.0

func (x *NameServer) GetClientIp() []byte

func (*NameServer) GetDisableCache added in v1.250608.0

func (x *NameServer) GetDisableCache() bool

func (*NameServer) GetExpectedGeoip added in v1.250608.0

func (x *NameServer) GetExpectedGeoip() []*router.GeoIP

func (*NameServer) GetFinalQuery added in v1.250608.0

func (x *NameServer) GetFinalQuery() bool

func (*NameServer) GetOriginalRules

func (x *NameServer) GetOriginalRules() []*NameServer_OriginalRule

func (*NameServer) GetPolicyID added in v1.251201.0

func (x *NameServer) GetPolicyID() uint32

func (*NameServer) GetPrioritizedDomain

func (x *NameServer) GetPrioritizedDomain() []*NameServer_PriorityDomain

func (*NameServer) GetQueryStrategy added in v1.8.5

func (x *NameServer) GetQueryStrategy() QueryStrategy

func (*NameServer) GetServeExpiredTTL added in v1.251201.0

func (x *NameServer) GetServeExpiredTTL() uint32

func (*NameServer) GetServeStale added in v1.251201.0

func (x *NameServer) GetServeStale() bool

func (*NameServer) GetSkipFallback added in v1.5.0

func (x *NameServer) GetSkipFallback() bool

func (*NameServer) GetTag added in v1.250516.0

func (x *NameServer) GetTag() string

func (*NameServer) GetTimeoutMs added in v1.250516.0

func (x *NameServer) GetTimeoutMs() uint64

func (*NameServer) GetUnexpectedGeoip added in v1.250608.0

func (x *NameServer) GetUnexpectedGeoip() []*router.GeoIP

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=xray.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 (*NameServer_PriorityDomain) ProtoMessage

func (*NameServer_PriorityDomain) ProtoMessage()

func (*NameServer_PriorityDomain) ProtoReflect

func (*NameServer_PriorityDomain) Reset

func (x *NameServer_PriorityDomain) Reset()

func (*NameServer_PriorityDomain) String

func (x *NameServer_PriorityDomain) String() string

type QUICNameServer added in v1.5.0

type QUICNameServer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

QUICNameServer implemented DNS over QUIC

func NewQUICNameServer added in v1.5.0

func NewQUICNameServer(url *url.URL, disableCache bool, serveStale bool, serveExpiredTTL uint32, clientIP net.IP) (*QUICNameServer, error)

NewQUICNameServer creates DNS-over-QUIC client object for local resolving

func (*QUICNameServer) IsDisableCache added in v1.251201.0

func (s *QUICNameServer) IsDisableCache() bool

IsDisableCache implements Server.

func (*QUICNameServer) Name added in v1.5.0

func (s *QUICNameServer) Name() string

Name implements Server.

func (*QUICNameServer) QueryIP added in v1.5.0

func (s *QUICNameServer) QueryIP(ctx context.Context, domain string, option dns_feature.IPOption) ([]net.IP, uint32, error)

QueryIP implements Server.

type QueryStrategy added in v1.5.0

type QueryStrategy int32
const (
	QueryStrategy_USE_IP  QueryStrategy = 0
	QueryStrategy_USE_IP4 QueryStrategy = 1
	QueryStrategy_USE_IP6 QueryStrategy = 2
	QueryStrategy_USE_SYS QueryStrategy = 3
)

func (QueryStrategy) Descriptor added in v1.5.0

func (QueryStrategy) Enum added in v1.5.0

func (x QueryStrategy) Enum() *QueryStrategy

func (QueryStrategy) EnumDescriptor deprecated added in v1.5.0

func (QueryStrategy) EnumDescriptor() ([]byte, []int)

Deprecated: Use QueryStrategy.Descriptor instead.

func (QueryStrategy) Number added in v1.5.0

func (QueryStrategy) String added in v1.5.0

func (x QueryStrategy) String() string

func (QueryStrategy) Type added in v1.5.0

type Server

type Server interface {
	// Name of the Client.
	Name() string

	IsDisableCache() bool

	// QueryIP sends IP queries to its configured server.
	QueryIP(ctx context.Context, domain string, option dns.IPOption) ([]net.IP, uint32, error)
}

Server is the interface for Name Server.

func NewServer added in v1.5.0

func NewServer(ctx context.Context, dest net.Destination, dispatcher routing.Dispatcher, disableCache bool, serveStale bool, serveExpiredTTL uint32, clientIP net.IP) (Server, error)

NewServer creates a name server object according to the network destination url.

type StaticHosts

type StaticHosts struct {
	// contains filtered or unexported fields
}

StaticHosts represents static domain-ip mapping in DNS server.

func NewStaticHosts

func NewStaticHosts(hosts []*Config_HostMapping) (*StaticHosts, error)

NewStaticHosts creates a new StaticHosts instance.

func NewStaticHostsFromCache added in v1.260131.0

func NewStaticHostsFromCache(matcher strmatcher.IndexMatcher, hostIPs map[string][]string) (*StaticHosts, error)

func (*StaticHosts) Lookup added in v1.5.0

func (h *StaticHosts) Lookup(domain string, option dns.IPOption) ([]net.Address, error)

Lookup returns IP addresses or proxied domain for the given domain, if exists in this StaticHosts.

type TCPNameServer added in v1.5.0

type TCPNameServer struct {
	// contains filtered or unexported fields
}

TCPNameServer implemented DNS over TCP (RFC7766).

func NewTCPLocalNameServer added in v1.5.0

func NewTCPLocalNameServer(url *url.URL, disableCache bool, serveStale bool, serveExpiredTTL uint32, clientIP net.IP) (*TCPNameServer, error)

NewTCPLocalNameServer creates DNS over TCP client object for local resolving

func NewTCPNameServer added in v1.5.0

func NewTCPNameServer(
	url *url.URL,
	dispatcher routing.Dispatcher,
	disableCache bool, serveStale bool, serveExpiredTTL uint32,
	clientIP net.IP,
) (*TCPNameServer, error)

NewTCPNameServer creates DNS over TCP server object for remote resolving.

func (*TCPNameServer) IsDisableCache added in v1.251201.0

func (s *TCPNameServer) IsDisableCache() bool

IsDisableCache implements Server.

func (*TCPNameServer) Name added in v1.5.0

func (s *TCPNameServer) Name() string

Name implements Server.

func (*TCPNameServer) QueryIP added in v1.5.0

func (s *TCPNameServer) QueryIP(ctx context.Context, domain string, option dns_feature.IPOption) ([]net.IP, uint32, error)

QueryIP implements Server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL