Documentation ¶
Overview ¶
Package doh (aka) internal/resolver/doh is a resolver implementation which handles (DoH) lookups via remote servers.
Typical usage is pretty straightforward. Create the resolver once then use it to resolve dns.Msgs.
res, err := dohresolver.New(dohresolver.Config{....}, &http.Client) for { qname, msg := getMsg() if res.InBailiwick(qname) { reply, details, err := res.Resolve(*dns.Msg) if err == nil { handleReply(reply) .. } } }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(config Config, httpClient HTTPClientDo) (*remote, error)
New creates a remote struct which supplies the internal/resolver/Resolver interface. A constructor Config is pass in which contains the various parameters needed to create the Resolver. We have to re-check a lot of what the cli programs using us have already done, but that's unavoidable really as we can't rely on callers to get our config right.
Types ¶
type Config ¶
type Config struct { UseGetMethod bool // Instead of the default POST GeneratePadding bool // RFC8467 query and response padding with zeroes ECSRedactResponse bool // If server-side synthesis/set remove ECS before returning to client ECSRemove bool // If ECS options are removed from inbound queries ECSRequestIPv4PrefixLen int // Server-side synthesis if client address is IPv4 - 0=no synth ECSRequestIPv6PrefixLen int // Server-side synthesis if client address is IPv6 - 0=no synth ECSSetCIDR *net.IPNet // Set the ECS locally with this CIDR - cannot have ECSRequest* as well bestserver.LatencyConfig // Latency Config and Server URLs are passed down ServerURLs []string // to the DoH resolver. }
Config is passed to the New() constructor.
type HTTPClientDo ¶
HTTPClientDo is an interface which implements http.Client.Do() - the only http.Client method used by the DoH resolver. It mainly exists so we can supply a mock http.Client for testing. We cannot provide an alternate http.Client because http.Client is an implementation struct rather than an interface.