resolver

package
v0.0.0-...-31d6df7 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCookieMismatch = errors.New("client cookie returned from server invalid")
View Source
var ErrNoRefreshCacheDuringRefetch = fmt.Errorf("unnecessary to refresh cache during refetch")

Functions

This section is empty.

Types

type Generator

type Generator struct {
	ServerStrategy ServerStrategy
	Servers        []*ServerConfig

	MaxIdleTime   time.Duration
	Attempts      int
	RetryWait     time.Duration
	LogFailures   bool
	RequireCookie bool

	AllowOnlyFromPrivate bool

	CacheMaxTTL               int
	CacheMinTTL               int
	CacheNoReplyTTL           int
	CacheStaleEntryKeepPeriod time.Duration
	CacheReturnStalePeriod    time.Duration

	CurrentTime func() time.Time

	RecordMinTTL uint32
	RecordMaxTTL uint32

	OpportunisticCacheMinHits     uint64
	OpportunisticCacheMaxTimeLeft time.Duration
	// contains filtered or unexported fields
}

func New

func New(servers []*ServerConfig) *Generator

func (*Generator) FlushCache

func (r *Generator) FlushCache()

func (*Generator) GetName

func (r *Generator) GetName() string

func (*Generator) Refresh

func (r *Generator) Refresh() error

func (*Generator) ServeDNS

func (r *Generator) ServeDNS(wr dns.ResponseWriter, msg *dns.Msg)

func (*Generator) SetCacheSize

func (r *Generator) SetCacheSize(size int)

func (*Generator) Start

func (r *Generator) Start() error

func (*Generator) Stop

func (r *Generator) Stop() error

type ServerConfig

type ServerConfig struct {
	Addr               string
	Proto              string
	ServerName         string
	RequireCookie      bool
	MaxParallelQueries int

	Timeout time.Duration
	// contains filtered or unexported fields
}

type ServerStrategy

type ServerStrategy int
const (
	StrategyRoundRobin ServerStrategy = iota
	StrategyRandom
	StrategyFailover
)

Jump to

Keyboard shortcuts

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