Documentation ¶
Overview ¶
Package resolver implements a stub DNS resolver that can also serve records out of an internal local zone.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("closed")
ErrClosed indicates that the resolver has been closed and readers should exit.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Routes is a map of DNS name suffix to the resolvers to use for // queries within that suffix. // Queries only match the most specific suffix. // To register a "default route", add an entry for ".". Routes map[dnsname.FQDN][]netaddr.IPPort // LocalHosts is a map of FQDNs to corresponding IPs. Hosts map[dnsname.FQDN][]netaddr.IP // LocalDomains is a list of DNS name suffixes that should not be // routed to upstream resolvers. LocalDomains []dnsname.FQDN }
Config is a resolver configuration. Given a Config, queries are resolved in the following order: If the query is an exact match for an entry in LocalHosts, return that. Else if the query suffix matches an entry in LocalDomains, return NXDOMAIN. Else forward the query to the most specific matching entry in Routes. Else return SERVFAIL.
type ForwardLinkSelector ¶ added in v1.10.0
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is a DNS resolver for nodes on the Tailscale network, associating them with domain names of the form <mynode>.<mydomain>.<root>. If it is asked to resolve a domain that is not of that form, it delegates to upstream nameservers if any are set.
func New ¶
New returns a new resolver. linkMon optionally specifies a link monitor to use for socket rebinding.
func (*Resolver) Close ¶
func (r *Resolver) Close()
Close shuts down the resolver and ensures poll goroutines have exited. The Resolver cannot be used again after Close is called.
func (*Resolver) EnqueueRequest ¶
EnqueueRequest places the given DNS request in the resolver's queue. It takes ownership of the payload and does not block. If the queue is full, the request will be dropped and an error will be returned.
func (*Resolver) NextResponse ¶
NextResponse returns a DNS response to a previously enqueued request. It blocks until a response is available and gives up ownership of the response payload.