client

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	dns.Client
	DCache DelegationCache
	LCache LookupCache
}

Client is a DNS client capable of performing parallel requests.

func New added in v1.1.0

func New() Client

New creates a new Client.

func (*Client) ParallelQuery

func (c *Client) ParallelQuery(m *dns.Msg, servers []Server) Responses

ParallelQuery perform an exchange using m with all servers in parallel and return all responses.

func (*Client) RecursiveQuery added in v1.1.0

func (c *Client) RecursiveQuery(m *dns.Msg, tracer Tracer) (r *dns.Msg, rtt time.Duration, err error)

RecursiveQuery performs a recursive query by querying all the available name servers to gather statistics.

type DelegationCache

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

DelegationCache store and retrive delegations.

func (*DelegationCache) Add

func (d *DelegationCache) Add(domain string, s Server) error

Add adds a server as a delegation for domain. If addrs is not specified, server will be looked up. An error is returned in case of lookup error.

func (*DelegationCache) Get

func (d *DelegationCache) Get(domain string) (label string, servers []Server)

Get returns the most specific name servers for domain with its matching label.

type LookupCache added in v1.1.0

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

LookupCache stores mixed lookup results for A and AAAA records of labels with not support of TTL.

func (*LookupCache) Get added in v1.1.0

func (c *LookupCache) Get(label string) []string

func (*LookupCache) Set added in v1.1.0

func (c *LookupCache) Set(label string, addrs []string)

type Response

type Response struct {
	Server Server
	Addr   string
	Msg    *dns.Msg
	RTT    time.Duration
	Err    error
}

Response stores a DNS response.

type ResponseType added in v1.3.0

type ResponseType int
const (
	ResponseTypeUnknown ResponseType = iota
	ResponseTypeDelegation
	ResponseTypeCNAME
	ResponseTypeFinal
)

type Responses

type Responses []Response

func (Responses) Fastest

func (rs Responses) Fastest() *Response

Fastest returns the fastest success response or nil.

type Server

type Server struct {
	Name      string
	HasGlue   bool
	TTL       uint32
	Addrs     []string
	LookupRTT time.Duration
	LookupErr error
}

Server is a name server hostname with associated IP addresses.

func (Server) String

func (s Server) String() string

type Tracer added in v1.1.0

type Tracer struct {
	GotIntermediaryResponse func(i int, m *dns.Msg, rs Responses, rtype ResponseType)
	FollowingCNAME          func(domain, target string)
}

Jump to

Keyboard shortcuts

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