Documentation
¶
Overview ¶
Package recursor performs iterative DNS recursion for lookup helpers.
Index ¶
- Variables
- func IgnoreCNAMEError(err error) error
- type CNAMEError
- type CNAMEReason
- type CacheEntry
- type NameserverRef
- type Recursor
- func (r *Recursor) AddFakeAddresses(domain string, data map[string][]string) error
- func (r *Recursor) ClearCache()
- func (r *Recursor) Client() *transport.Client
- func (r *Recursor) ExportCacheEntries() ([]CacheEntry, error)
- func (r *Recursor) GetAddressesFor(ctx context.Context, name string) ([]netip.Addr, error)
- func (r *Recursor) GetFakeAddresses(domain string, nsname string) []netip.Addr
- func (r *Recursor) GetFakeNames(domain string) []string
- func (r *Recursor) HasFakeAddresses(domain string) bool
- func (r *Recursor) ImportCacheEntries(entries []CacheEntry) error
- func (r *Recursor) Parent(ctx context.Context, name string) (string, packet.Packet, error)
- func (r *Recursor) PrimeCacheError(name, qtype string, err error)
- func (r *Recursor) Recurse(ctx context.Context, name string, qtype string, qclass string) (packet.Packet, error)
- func (r *Recursor) RecurseWithNameservers(ctx context.Context, name string, qtype string, qclass string, ...) (packet.Packet, error)
- func (r *Recursor) RemoveFakeAddresses(domain string)
- func (r *Recursor) RootServers(ctx context.Context) ([]nameserver.Nameserver, error)
- func (r *Recursor) SetNegativeCacheTTL(ttl time.Duration)
Constants ¶
This section is empty.
Variables ¶
var ErrRaceLost = errors.New("recursor: parallel race lost")
ErrRaceLost is the cause attached to the cancellation of a parallel fan-out's batch context when one goroutine has already produced a usable answer and the rest are being cancelled.
Callers that observe context cancellation in code paths that may be reached via parallel recursion can distinguish a race-loss cancellation from a job-level cancellation by inspecting context.Cause(ctx).
Functions ¶
func IgnoreCNAMEError ¶ added in v1.4.10
IgnoreCNAMEError returns nil if err is a *CNAMEError, and err otherwise.
Types ¶
type CNAMEError ¶ added in v1.4.10
type CNAMEError struct {
Reason CNAMEReason
Name string
Target string
Detail string
}
CNAMEError is returned by Recurse when CNAME handling fails.
func (*CNAMEError) Error ¶ added in v1.4.10
func (e *CNAMEError) Error() string
type CNAMEReason ¶ added in v1.4.10
type CNAMEReason int
CNAMEReason identifies which CNAME-handling failure the recursor hit.
const ( // CNAMETooMany covers per-answer cardinality and chain-walk inside one answer. CNAMETooMany CNAMEReason = iota + 1 // CNAMEChainTooLong is the chain-depth bound across recursion hops. CNAMEChainTooLong // CNAMEUnresolved is "target can't be reached": loop, broken chain, qtype mismatch. CNAMEUnresolved )
func (CNAMEReason) String ¶ added in v1.4.10
func (r CNAMEReason) String() string
type CacheEntry ¶ added in v1.3.2
type CacheEntry struct {
Name string
QType string
QClass string
Nameservers []NameserverRef
Message []byte
}
CacheEntry is a portable representation of a single recursor cache record.
type NameserverRef ¶ added in v1.3.2
NameserverRef identifies a nameserver host+address pair.
type Recursor ¶
type Recursor struct {
// contains filtered or unexported fields
}
Recursor holds root hints and fake delegations.
func (*Recursor) AddFakeAddresses ¶
AddFakeAddresses stores fake addresses for a domain.
func (*Recursor) ClearCache ¶
func (r *Recursor) ClearCache()
ClearCache clears the recursive cache.
func (*Recursor) ExportCacheEntries ¶ added in v1.3.2
func (r *Recursor) ExportCacheEntries() ([]CacheEntry, error)
ExportCacheEntries returns a deterministic snapshot of the recursor cache.
func (*Recursor) GetAddressesFor ¶
GetAddressesFor resolves A and AAAA addresses for a nameserver name.
func (*Recursor) GetFakeAddresses ¶
GetFakeAddresses returns fake addresses for a domain and nameserver name.
func (*Recursor) GetFakeNames ¶
GetFakeNames returns fake nameserver names for a domain.
func (*Recursor) HasFakeAddresses ¶
HasFakeAddresses reports whether a domain has fake address data.
func (*Recursor) ImportCacheEntries ¶ added in v1.3.2
func (r *Recursor) ImportCacheEntries(entries []CacheEntry) error
ImportCacheEntries populates the recursor cache from the supplied entries.
func (*Recursor) PrimeCacheError ¶ added in v1.4.10
PrimeCacheError stores err so the next Recurse for (name, qtype, IN) against root returns it. For tests and saved-cache replay.
func (*Recursor) Recurse ¶
func (r *Recursor) Recurse(ctx context.Context, name string, qtype string, qclass string) (packet.Packet, error)
Recurse performs a recursive lookup using root servers.
func (*Recursor) RecurseWithNameservers ¶
func (r *Recursor) RecurseWithNameservers(ctx context.Context, name string, qtype string, qclass string, ns []nameserver.Nameserver) (packet.Packet, error)
RecurseWithNameservers performs a recursive lookup using a specific nameserver set.
func (*Recursor) RemoveFakeAddresses ¶
RemoveFakeAddresses deletes fake address data for a domain.
func (*Recursor) RootServers ¶
func (r *Recursor) RootServers(ctx context.Context) ([]nameserver.Nameserver, error)
RootServers returns nameservers initialized from root hints.
func (*Recursor) SetNegativeCacheTTL ¶ added in v1.4.5
SetNegativeCacheTTL controls the lifetime of cached "no answer" entries. Zero (default) disables negative caching.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package recursortest provides test-only helpers for driving the recursor's cache directly, without simulating an upstream walk.
|
Package recursortest provides test-only helpers for driving the recursor's cache directly, without simulating an upstream walk. |