authority

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sort

func Sort(serversList []*Server, called uint64)

Sort sort servers by rtt.

Types

type Cache

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

Cache type.

func NewCache

func NewCache() *Cache

NewCache return new cache.

func (*Cache) Get

func (n *Cache) Get(key uint64) (*Delegation, error)

(*Cache).Get returns the delegation entry for a key or an error.

func (*Cache) Remove

func (n *Cache) Remove(key uint64)

(*Cache).Remove remove remove a cache.

func (*Cache) Set

func (n *Cache) Set(key uint64, dsSet []dns.RR, servers *Servers, ttl time.Duration)

(*Cache).Set stores a delegation entry under the given key.

type Delegation

type Delegation struct {
	Servers *Servers
	DSSet   []dns.RR
	TTL     time.Duration
	// contains filtered or unexported fields
}

Delegation represents a cache entry holding the authoritative servers for a zone plus the DS RRset that proves the delegation.

type IPVersion

type IPVersion byte

IPVersion type.

const (
	// IPv4 mode.
	IPv4 IPVersion = 0x1

	// IPv6 mode.
	IPv6 IPVersion = 0x2
)

func (IPVersion) String

func (v IPVersion) String() string

type Server

type Server struct {
	// place atomic members at the start to fix alignment for ARM32
	Rtt       int64
	Count     int64
	Addr      string
	IPVersion IPVersion

	// UDPAddr is Addr pre-parsed as *net.UDPAddr so the upstream
	// exchange path can use net.DialUDP directly instead of going
	// through Dialer.DialContext's string-parsing + dialParallel
	// machinery. Nil only if Addr failed to parse — callers fall
	// back to the string path in that case.
	UDPAddr *net.UDPAddr
}

Server type.

func NewServer

func NewServer(addr string, ipVersion IPVersion) *Server

NewServer return a new server. addr is expected to be an "IP:port" pair — the IP is parsed once here so upstream exchanges can skip Go's DialContext address-resolution path.

func (*Server) String

func (a *Server) String() string

type Servers

type Servers struct {
	sync.RWMutex
	// place atomic members at the start to fix alignment for ARM32
	Called     uint64
	ErrorCount uint32

	Zone string

	List  []*Server
	Hosts []string

	CheckingDisable bool
	Checked         bool
	// contains filtered or unexported fields
}

Servers type.

func (*Servers) Fingerprint

func (a *Servers) Fingerprint() uint64

Fingerprint returns a stable identifier for the current List.Addr set. Callers must not hold the Servers lock.

func (*Servers) InvalidateFingerprint

func (a *Servers) InvalidateFingerprint()

InvalidateFingerprint must be called whenever List is mutated. It has to run *before* the mutator releases the Servers write lock so readers can't observe the mutated List with a still-valid cached hash. A single atomic increment is cheap enough to keep inside the critical section.

Jump to

Keyboard shortcuts

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