Documentation ¶
Overview ¶
Package exchanger provides DNS exchanger decorators and other utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decorator ¶
A Decorator adds a layer of behaviour to a given Exchanger.
var IgnoreErrTruncated Decorator = func(ex Exchanger) Exchanger { return Func(func(m *dns.Msg, a string) (r *dns.Msg, rtt time.Duration, err error) { r, rtt, err = ex.Exchange(m, a) return }) }
IgnoreErrTruncated is a Decorator which causes dns.ErrTruncated to be ignored
func ErrorLogging ¶
ErrorLogging returns a Decorator which logs an Exchanger's errors to the given logger.
func Instrumentation ¶
Instrumentation returns a Decorator which instruments an Exchanger with the given counters.
type Exchanger ¶
type Exchanger interface { // Exchange performs an synchronous query. It sends the message m to the address // contained in addr (host:port) and waits for a reply. Exchange(m *dns.Msg, addr string) (r *dns.Msg, rtt time.Duration, err error) }
Exchanger is an interface capturing a dns.Client Exchange method.
type ForwardError ¶
A ForwardError is returned by Forwarders when they can't forward.
func (ForwardError) Error ¶
func (e ForwardError) Error() string
Error implements the error interface.
type Forwarder ¶
A Forwarder is a DNS message forwarder that transparently proxies messages to DNS servers.
func NewForwarder ¶
NewForwarder returns a new Forwarder for the given addrs with the given Exchangers map which maps network protocols to Exchangers.
Every message will be exchanged with each address until no error is returned. If no addresses or no matching protocol exchanger exist, a *ForwardError will be returned.