types

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultTimeout = 100 * time.Millisecond

DefaultTimeout is the duration waited until a DNS query expires.

View Source
const RcodeNoResponse int = 50

RcodeNoResponse is a special status code used to indicate no response or package error.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn interface {
	Close()
	WriteMsg(msg *dns.Msg, ns Nameserver) error
}

type Nameserver

type Nameserver interface {
	Address() *net.UDPAddr
	XchgManager() XchgManager
	RateMonitor() RateTrack
	SendRequest(ctx context.Context, req Request, conns Conn) error
	RequestResponse(resp *dns.Msg, at time.Time)
	NsecTraversal(ctx context.Context, domain string, conns Conn) ([]*dns.NSEC, error)
	Close()
}

type RateTrack

type RateTrack interface {
	Wait(ctx context.Context, rrType uint16) error
	ReportResponse(rrType uint16, rCode int, rtt time.Duration)
}

type Request

type Request interface {
	Server() Nameserver
	SetServer(s Nameserver)
	SentAt() time.Time
	SetSentAt(t time.Time)
	Message() *dns.Msg
	SendResponse(resp *dns.Msg)
	NoResponse()
	Release()
}

func NewRequest

func NewRequest(msg *dns.Msg, ch chan *dns.Msg) Request

type Selector

type Selector interface {
	// Get returns a nameserverr managed by the selector.
	Get(fqdn string) (Nameserver, error)

	// Lookup returns the nameserver with the matching address.
	Lookup(addr string) (Nameserver, error)

	// All returns all the nameservers currently managed by the selector.
	All() []Nameserver

	// Close releases all resources allocated by the selector.
	Close()
}

type XchgManager

type XchgManager interface {
	Add(req Request) error
	Modify(id uint16, name string, callback func(req Request)) error
	Remove(id uint16, name string) (Request, bool)
	RemoveExpired(timeout time.Duration) []Request
	RemoveAll() []Request
	Delete(keys []string) []Request
}

XchgManager handles DNS message IDs and identifying messages that have timed out.

Jump to

Keyboard shortcuts

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