dnsserver

package
v0.0.0-...-8375cc0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2016 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPort = 53

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	IPv4, IPv6 net.IP
	TTL        time.Duration
	Blocker    Blocker
	Passer     Passer
	Logger     slog.Interface
}

func (Block) NewReply

func (b Block) NewReply(req *dns.Msg) *dns.Msg

func (Block) Should

func (b Block) Should(req *dns.Msg) bool

type Blocker

type Blocker interface {
	Block(host string) bool
}

type DNSHTTP

type DNSHTTP struct {
	KeepAlive             time.Duration
	MaxIdleConns          int
	MaxIdleConnsPerHost   int
	IdleConnTimeout       time.Duration
	TLSHandshakeTimeout   time.Duration
	ExpectContinueTimeout time.Duration
	NoDNSSEC              bool
	EDNSClientSubnet      string
	NoRandomPadding       bool
	// contains filtered or unexported fields
}

type DNSServer

type DNSServer struct {
	Listen []string

	Block             Block
	Override          Overrider
	OverrideTTL       time.Duration
	Logger            slog.Interface
	ClientTimeout     time.Duration
	ServerTimeout     time.Duration
	DialTimeout       time.Duration
	LookupInterval    time.Duration
	Cache             dnscache.Cache
	NotifyStartedFunc func() error
	Zones             map[string][]string
	HTTP              DNSHTTP
	// contains filtered or unexported fields
}

func (*DNSServer) Handler

func (d *DNSServer) Handler(net string, addr []string) dns.Handler

func (*DNSServer) ListenAndServe

func (d *DNSServer) ListenAndServe() error

func (*DNSServer) Shutdown

func (d *DNSServer) Shutdown()

type HTTPSQuestion

type HTTPSQuestion struct {
	Name string // FQDN with trailing dot
	Type uint16 // Standard DNS RR type
}

type HTTPSRR

type HTTPSRR struct {
	Name string // Always matches name in the Question section
	Type uint16 // Standard DNS RR type
	TTL  uint32 // Record's time-to-live in seconds

	// Data for A - IP address as text
	// Data for SPF - quoted string
	// Data for TXT - multiple quoted strings
	Data string
}

func (HTTPSRR) DNSRR

func (hrr HTTPSRR) DNSRR() (dns.RR, error)

type HTTPSResponse

type HTTPSResponse struct {
	Status           int  // Standard DNS response code (32 bit integer)
	TC               bool // Whether the response is truncated
	RD               bool // Always true for Google Public DNS
	RA               bool // Always true for Google Public DNS
	AD               bool // Whether all response data was validated with DNSSEC
	CD               bool // Whether the client asked to disable DNSSEC
	Question         []HTTPSQuestion
	Answer           []HTTPSRR
	Authority        []HTTPSRR
	Additional       []HTTPSRR
	EDNSClientSubnet string `json:"edns_client_subnet"` // IP address / scope prefix-length
	Comment          string
}

type Overrider

type Overrider interface {
	Override(string) []net.IP
}

type Passer

type Passer interface {
	Pass(host string) bool
}

type ResolvError

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

ResolvError type

func (ResolvError) Error

func (e ResolvError) Error() string

Error formats a ResolvError

Jump to

Keyboard shortcuts

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