resolver

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package resolver is the interface for resolving a dns.Msg via a local or DoH resolver

Index

Constants

View Source
const (
	DNSTransportUndefined DNSTransportType = ""
	DNSTransportHTTP                       = "http"
	DNSTransportUDP                        = "udp"
	DNSTransportTCP                        = "tcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSTransportType

type DNSTransportType string

DNSTransportType defines the transport type used to carry the DNS query

type QueryMetaData

type QueryMetaData struct {
	TransportType DNSTransportType // Of the original inbound query
}

QueryMetaData is a primordial struct containing metadata about the query passed to Resolve(). It helps the function make fine-grained decisions about how to perform the resolution. For example whether the original query originated as a TCP query or is a re-query due to a previous truncation attempt. This structure is needed as DNS messages, unlike more recently protocols, have almost no ability to add meta data as needed. Compare with email and nttp headers.

Primordial because there really isn't much to it at this stage - as you can see. It's mostly a place-holder in the event that we want to add more stuff later.

type Resolver

type Resolver interface {
	// Return true if this resolver handles this qName
	InBailiwick(qName string) bool

	// Resolve() resolved the dns.Msg query. Returns resp+respMeta or error. queryMeta can be
	// nil.
	Resolve(query *dns.Msg, queryMeta *QueryMetaData) (resp *dns.Msg, respMeta *ResponseMetaData, err error)
}

type ResponseMetaData

type ResponseMetaData struct {
	TransportType DNSTransportType // Final transport used with the resultant query

	TransportDuration  time.Duration // Does not include ResolutionDuration
	ResolutionDuration time.Duration // Time taken caller actual resolver system

	PayloadSize     int
	QueryTries      int    // Number of resolution attempts were made
	ServerTries     int    // Number of different servers were tried
	FinalServerUsed string // Name of the last server attempted
}

ResponseMetaData returns metadata about the qhery made by Resolve(). It mostly contains statistical and trace meta-information.

Directories

Path Synopsis
Package doh (aka) internal/resolver/doh is a resolver implementation which handles (DoH) lookups via remote servers.
Package doh (aka) internal/resolver/doh is a resolver implementation which handles (DoH) lookups via remote servers.
Package local (aka internal/resolver/local) is a resolver implementation which handle local lookups via /etc/resolv.conf.
Package local (aka internal/resolver/local) is a resolver implementation which handle local lookups via /etc/resolv.conf.

Jump to

Keyboard shortcuts

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