Add resolver API definition and comprehensive test suite
35 tests define the full resolver contract using live DNS queries against *.dns.sneak.cloud (Cloudflare). Tests cover: - FindAuthoritativeNameservers: iterative NS discovery, sorting, determinism, trailing dot handling, TLD and subdomain cases - QueryNameserver: A, AAAA, CNAME, MX, TXT, NXDOMAIN, per-NS response model with status field, sorted record values - QueryAllNameservers: independent per-NS queries, consistency verification, NXDOMAIN from all NS - LookupNS: NS record lookup matching FindAuthoritative - ResolveIPAddresses: basic, multi-A, IPv6, dual-stack, CNAME following, deduplication, sorting, NXDOMAIN returns empty - Context cancellation for all methods - Iterative resolution proof (resolves example.com from root) Also adds DNSSEC validation to planned future features in README.
This commit is contained in:
27
internal/resolver/errors.go
Normal file
27
internal/resolver/errors.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package resolver
|
||||
|
||||
import "errors"
|
||||
|
||||
// Sentinel errors returned by the resolver.
|
||||
var (
|
||||
// ErrNotImplemented indicates a method is stubbed out.
|
||||
ErrNotImplemented = errors.New(
|
||||
"resolver not yet implemented",
|
||||
)
|
||||
|
||||
// ErrNoNameservers is returned when no authoritative NS
|
||||
// could be discovered for a domain.
|
||||
ErrNoNameservers = errors.New(
|
||||
"no authoritative nameservers found",
|
||||
)
|
||||
|
||||
// ErrCNAMEDepthExceeded is returned when a CNAME chain
|
||||
// exceeds MaxCNAMEDepth.
|
||||
ErrCNAMEDepthExceeded = errors.New(
|
||||
"CNAME chain depth exceeded",
|
||||
)
|
||||
|
||||
// ErrContextCanceled wraps context cancellation for the
|
||||
// resolver's iterative queries.
|
||||
ErrContextCanceled = errors.New("context canceled")
|
||||
)
|
||||
Reference in New Issue
Block a user