resolver

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireBuf added in v1.0.0

func AcquireBuf(size uint16) []byte

AcquireBuf returns an buf from pool

func AcquireMsg added in v1.0.0

func AcquireMsg() *dns.Msg

AcquireMsg returns an empty msg from pool

func ReleaseBuf added in v1.0.0

func ReleaseBuf(buf []byte)

ReleaseBuf returns buf to pool

func ReleaseConn added in v1.0.0

func ReleaseConn(co *Conn)

ReleaseConn returns req to pool

func ReleaseMsg added in v1.0.0

func ReleaseMsg(req *dns.Msg)

ReleaseMsg returns req to pool

Types

type Conn added in v1.0.0

type Conn struct {
	net.Conn                     // a net.Conn holding the connection
	UDPSize    uint16            // minimum receive buffer for UDP messages
	TsigSecret map[string]string // secret(s) for Tsig map[<zonename>]<base64 secret>, zonename must be in canonical form (lowercase, fqdn, see RFC 4034 Section 6.2)
	// contains filtered or unexported fields
}

A Conn represents a connection to a DNS server.

func AcquireConn added in v1.0.0

func AcquireConn() *Conn

AcquireConn returns an empty conn from pool

func (*Conn) Exchange added in v1.0.0

func (co *Conn) Exchange(m *dns.Msg) (r *dns.Msg, rtt time.Duration, err error)

Exchange performs a synchronous query

func (*Conn) Read added in v1.0.0

func (co *Conn) Read(p []byte) (n int, err error)

Read implements the net.Conn read method.

func (*Conn) ReadMsg added in v1.0.0

func (co *Conn) ReadMsg() (*dns.Msg, error)

ReadMsg reads a message from the connection co. If the received message contains a TSIG record the transaction signature is verified. This method always tries to return the message, however if an error is returned there are no guarantees that the returned message is a valid representation of the packet read.

func (*Conn) ReadMsgHeader added in v1.0.0

func (co *Conn) ReadMsgHeader() ([]byte, error)

ReadMsgHeader reads a DNS message, parses and populates hdr (when hdr is not nil). Returns message as a byte slice to be parsed with Msg.Unpack later on. Note that error handling on the message body is not possible as only the header is parsed.

func (*Conn) Write added in v1.0.0

func (co *Conn) Write(p []byte) (int, error)

Write implements the net.Conn Write method.

func (*Conn) WriteMsg added in v1.0.0

func (co *Conn) WriteMsg(m *dns.Msg) (err error)

WriteMsg sends a message through the connection co. If the message m contains a TSIG record the transaction signature is calculated.

type DNSHandler

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

DNSHandler type

func New

func New(cfg *config.Config) *DNSHandler

New returns a new Handler

func (*DNSHandler) Name

func (h *DNSHandler) Name() string

Name return middleware name

func (*DNSHandler) ServeDNS

func (h *DNSHandler) ServeDNS(ctx context.Context, ch *middleware.Chain)

ServeDNS implements the Handle interface.

type Resolver

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

Resolver type

func NewResolver

func NewResolver(cfg *config.Config) *Resolver

NewResolver return a resolver

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, req *dns.Msg, servers *authcache.AuthServers, root bool, depth int, level int, nomin bool, parentdsrr []dns.RR, extra ...bool) (*dns.Msg, error)

Resolve iterate recursively over the domains

Jump to

Keyboard shortcuts

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