Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
type ResolverConfig ¶
type ResolverConfig struct { // Name is the resolver's name. // The name must be unique among all resolvers. Name string `json:"name"` // Type is the resolver type. // // Available values: // - "plain": Resolve names by sending cleartext DNS queries to the configured upstream server. // - "system": Use the system resolver. This does not support custom server addresses or clients. // // The default value is "plain". Type string `json:"type"` // AddrPort is the upstream server's address and port. AddrPort netip.AddrPort `json:"addrPort"` // TCPClientName is the name of the TCPClient to use. // Leave empty to disable TCP. TCPClientName string `json:"tcpClientName"` // UDPClientName is the name of the UDPClient to use. // Leave empty to disable UDP. UDPClientName string `json:"udpClientName"` }
ResolverConfig configures a DNS resolver.
func (*ResolverConfig) SimpleResolver ¶ added in v1.8.0
func (rc *ResolverConfig) SimpleResolver(tcpClientMap map[string]zerocopy.TCPClient, udpClientMap map[string]zerocopy.UDPClient, logger *zap.Logger) (SimpleResolver, error)
SimpleResolver creates a new SimpleResolver from the config.
type Result ¶
type Result struct { IPv4 []netip.Addr IPv6 []netip.Addr // TTL is the minimum TTL of A and AAAA RRs. TTL time.Time }
Result represents the result of name resolution.
type SimpleResolver ¶ added in v1.8.0
type SimpleResolver interface { // LookupIP looks up [name] and returns one of the associated IP addresses. LookupIP(ctx context.Context, name string) (netip.Addr, error) // LookupIPs looks up [name] and returns all associated IP addresses. LookupIPs(ctx context.Context, name string) ([]netip.Addr, error) }
SimpleResolver defines methods that only return the resolved IP addresses.
type SystemResolver ¶ added in v1.8.0
type SystemResolver struct {
// contains filtered or unexported fields
}
SystemResolver resolves names using net.DefaultResolver. It implements SimpleResolver.
func NewSystemResolver ¶ added in v1.8.0
func NewSystemResolver(name string, logger *zap.Logger) *SystemResolver
NewSystemResolver returns a new SystemResolver.
Click to show internal directories.
Click to hide internal directories.