keyresolver

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package keyresolver owns bounded DNS-02 query, TXT transport, key-record, decoding, cache, and coalesced-flight semantics.

Queries validate ASCII selectors and signing domains, preserve dotted selector label boundaries, and construct lowercase absolute <selector>._domainkey.<domain>. owners. Input is rejected before transport when a component, aggregate owner, algorithm, or limit is invalid. Owners, selectors, domains, records, keys, cache keys, and raw provider errors never enter diagnostics.

TXTTransport preserves resource-record count and supplies an already- concatenated payload only for one RR. Character-string chunks within that RR are concatenated by the transport without inserted whitespace. Multiple RRs are permanent ambiguity and retain only their count; they are never traversed or joined. Authoritative NXDOMAIN and NODATA carry distinct negative TTL provenance. DNSSECStatus is a closed diagnostic value with no verdict or TTL effect.

ParseRecord implements draft-ietf-dkim-dkim2-dns-02 using the shared tagvalue scanner. Lowercase k= is recognized according to the draft prose and RFC 6376 Erratum 5137 despite the inherited ABNF typo. DNS TXT is the sole lookup binding because the active signature grammar has no q=. Unknown and retired tags are ignored after generic validation, duplicate tags fail closed, and empty p= is revoked. The t= tag is retired by DNS-02 Section 3.4.1: it is subject only to the generic tag-list rules and never yields testing or strict-identity semantics. Non-empty p= permits omitted terminal Base64 padding as DNS-02 specifies, but canonical zero pad bits remain mandatory.

DecodeKey accepts PKCS#1 RSAPublicKey DER and X.509 SubjectPublicKeyInfo DER containing RSA, or exactly 32 raw Ed25519 public-key bytes, and keeps requested-algorithm mismatch distinct. Resolver outcomes form a closed found, missing, revoked, invalid, ambiguous, unsupported-key-type, algorithm-mismatch, temporary, permanent, and contract matrix. All material and result accessors return detached copies.

ResolveDomainPolicy resolves the Draft-09 Section 3.8 Domain Policy Record at _domainkey.<domain>. through the same transport, cache, single-flight, and limits. The owner kind is typed once (OwnerKind): selector and policy owners have disjoint grammars and therefore disjoint cache key spaces. Records not beginning with v=DKIM1 are ignored, more than one remaining record is ambiguous, an invalid record or a permanent failure is invalid, absence is authorized, and a temporary failure is temporary and never cached.

Resolver caches only TTL-backed stable outcomes under configured caps. Cache keys include absolute owner and requested algorithm; deterministic LRU, bounded concurrency, and bounded same-key waiters prevent hidden queues. Non-final canceled waiters leave independently. The final canceled waiter cancels and owns cleanup until the context-compliant transport worker retires; the resolver creates no cancellation helper for a transport that ignores its context.

Index

Constants

View Source
const (
	// AlgorithmRSASHA256 identifies an RSA-SHA256 key query.
	AlgorithmRSASHA256 = signature.AlgorithmRSASHA256
	// AlgorithmEd25519SHA256 identifies an Ed25519-SHA256 key query.
	AlgorithmEd25519SHA256 = signature.AlgorithmEd25519SHA256
	// AlgorithmMLDSA44 identifies a pure ML-DSA-44 key query.
	AlgorithmMLDSA44 = signature.AlgorithmMLDSA44
)
View Source
const DNSDraftIdentifier = "draft-ietf-dkim-dkim2-dns-02"

DNSDraftIdentifier records the active DNS key-record behavior baseline.

Variables

This section is empty.

Functions

func CanonicalSelector

func CanonicalSelector(value string, maxBytes, maxLabels int) (string, error)

CanonicalSelector validates and canonicalizes one bounded ASCII DNS selector.

func CanonicalSigningDomain

func CanonicalSigningDomain(value string, maxBytes, maxLabels int) (string, error)

CanonicalSigningDomain validates and canonicalizes one bounded ASCII DNS signing domain.

func IsErrorClass

func IsErrorClass(err error, class ErrorClass) bool

IsErrorClass reports whether err carries the requested known resolver class.

func IsRecordErrorCode

func IsRecordErrorCode(err error, code RecordErrorCode) bool

IsRecordErrorCode reports whether err carries the requested known parser code.

func NewTransportError

func NewTransportError(class TransportErrorClass) error

NewTransportError constructs one cause-free typed transport failure.

func ValidAbsoluteOwner

func ValidAbsoluteOwner(name string) bool

ValidAbsoluteOwner validates a canonical terminal-dot DKIM2 TXT owner of either kind using the query grammar. Transports accept both kinds; callers that need one kind use OwnerKind.ValidAbsoluteOwner.

Types

type AbsenceClass

type AbsenceClass string

AbsenceClass distinguishes authoritative NXDOMAIN from NODATA.

const (
	// AbsenceNXDOMAIN reports authoritative owner-name absence.
	AbsenceNXDOMAIN AbsenceClass = "nxdomain"
	// AbsenceNODATA reports an existing owner without TXT data.
	AbsenceNODATA AbsenceClass = "nodata"
)

func (AbsenceClass) Known

func (a AbsenceClass) Known() bool

Known reports whether the absence class belongs to the closed vocabulary.

type Algorithm

type Algorithm = signature.Algorithm

Algorithm aliases the signature owner's closed algorithm vocabulary.

type DNSSECStatus

type DNSSECStatus string

DNSSECStatus is verdict-neutral resolver diagnostic metadata.

const (
	// DNSSECStatusSecure reports a transport-provided secure diagnostic.
	DNSSECStatusSecure DNSSECStatus = "secure"
	// DNSSECStatusInsecure reports a transport-provided insecure diagnostic.
	DNSSECStatusInsecure DNSSECStatus = "insecure"
	// DNSSECStatusBogus reports a transport-provided bogus diagnostic.
	DNSSECStatusBogus DNSSECStatus = "bogus"
	// DNSSECStatusIndeterminate reports a transport-provided indeterminate diagnostic.
	DNSSECStatusIndeterminate DNSSECStatus = "indeterminate"
	// DNSSECStatusUnavailable reports that no DNSSEC diagnostic is available.
	DNSSECStatusUnavailable DNSSECStatus = "unavailable"
)

func (DNSSECStatus) Known

func (s DNSSECStatus) Known() bool

Known reports whether the diagnostic belongs to the closed DNSSEC vocabulary.

type DomainPolicyOutcome

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

DomainPolicyOutcome stores one immutable Domain Policy Record resolution.

func (DomainPolicyOutcome) Status

Status returns the closed policy outcome.

func (DomainPolicyOutcome) Valid

func (o DomainPolicyOutcome) Valid() bool

Valid reports whether the outcome is initialized and in the closed vocabulary.

type DomainPolicyQuery

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

DomainPolicyQuery owns one validated Domain Policy Record owner.

func NewDomainPolicyQuery

func NewDomainPolicyQuery(domain string, limits Limits) (DomainPolicyQuery, error)

NewDomainPolicyQuery validates one canonical A-label domain and constructs the absolute owner _domainkey.<domain>. (Draft-09 Section 3.8). The lookup uses the domain exactly: there is no walk up or down the DNS tree.

func (DomainPolicyQuery) AbsoluteOwner

func (q DomainPolicyQuery) AbsoluteOwner() string

AbsoluteOwner returns the canonical transport owner with a terminal root dot.

func (DomainPolicyQuery) Domain

func (q DomainPolicyQuery) Domain() string

Domain returns the canonical ASCII domain that holds the record.

type DomainPolicyRecord

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

DomainPolicyRecord is one parsed Draft-09 Section 3.8 Domain Policy Record.

func ParseDomainPolicyRecord

func ParseDomainPolicyRecord(input []byte, limits Limits) (DomainPolicyRecord, error)

ParseDomainPolicyRecord parses one already-concatenated TXT payload that begins with v=DKIM1 as a Draft-09 Section 3.8 Domain Policy Record. The tag-list follows Section 8 through the shared scanner; v= must be the first tag with the exact value DKIM1. The optional f= value is split on ':' with surrounding WSP trimmed from every flag (local interpretation D1, the draft gives no ABNF); flags are case-sensitive and unknown flags are ignored.

func (DomainPolicyRecord) Strict

func (r DomainPolicyRecord) Strict() bool

Strict reports whether the record carries the case-sensitive strict flag.

func (DomainPolicyRecord) Valid

func (r DomainPolicyRecord) Valid() bool

Valid reports whether the record was produced by the parser.

type DomainPolicyStatus

type DomainPolicyStatus string

DomainPolicyStatus identifies one closed Domain Policy Record outcome (Draft-09 Sections 3.8 and 7.1 item 3).

const (
	// DomainPolicyAuthorized reports that subdomains may make From header
	// fields of the domain Authentic: no record, NXDOMAIN, NODATA, no
	// record beginning with v=DKIM1, no f= tag, or no strict flag.
	DomainPolicyAuthorized DomainPolicyStatus = "authorized"
	// DomainPolicyStrict reports exactly one record whose f= tag carries the
	// strict flag.
	DomainPolicyStrict DomainPolicyStatus = "strict"
	// DomainPolicyTemporary reports a temporary DNS failure or a bounded
	// timeout; the relevant match result is TEMPERROR.
	DomainPolicyTemporary DomainPolicyStatus = "temporary"
	// DomainPolicyAmbiguous reports more than one record beginning with
	// v=DKIM1, or a count-only answer that cannot be filtered; PERMERROR.
	DomainPolicyAmbiguous DomainPolicyStatus = "ambiguous"
	// DomainPolicyInvalid reports a record that begins with v=DKIM1 but is
	// not a valid tag-list, an over-bound record, a permanent transport
	// failure, or contradictory transport state; PERMERROR (local fail-closed
	// interpretation D1, the draft is silent).
	DomainPolicyInvalid DomainPolicyStatus = "invalid"
)

func (DomainPolicyStatus) Known

func (s DomainPolicyStatus) Known() bool

Known reports whether the status belongs to the closed policy vocabulary.

type ErrorClass

type ErrorClass string

ErrorClass identifies a bounded resolver contract or permanent input failure.

const (
	// ErrorClassContract identifies zero, unknown, malformed, or contradictory injected state.
	ErrorClassContract ErrorClass = "contract"
	// ErrorClassPermanent identifies a valid query whose canonical DNS owner cannot be represented safely.
	ErrorClassPermanent ErrorClass = "permanent"
)

func (ErrorClass) Known

func (c ErrorClass) Known() bool

Known reports whether the class belongs to the closed resolver vocabulary.

type KeyOutcome

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

KeyOutcome stores detached key material or one exact permanent non-success state.

func DecodeKey

func DecodeKey(record Record, requested Algorithm) (KeyOutcome, error)

DecodeKey decodes one parsed DNS record for a supported requested algorithm.

func (KeyOutcome) Algorithm

func (o KeyOutcome) Algorithm() Algorithm

Algorithm returns the requested supported verification algorithm.

func (KeyOutcome) IsZero

func (o KeyOutcome) IsZero() bool

IsZero reports whether the outcome carries no initialized resolver state.

func (KeyOutcome) Material

func (o KeyOutcome) Material() any

Material returns an independent copy of supported public-key material.

func (KeyOutcome) Status

func (o KeyOutcome) Status() KeyOutcomeStatus

Status returns the closed structural decoding result.

func (KeyOutcome) Valid

func (o KeyOutcome) Valid() bool

Valid reports whether the outcome is initialized and internally coherent.

type KeyOutcomeStatus

type KeyOutcomeStatus string

KeyOutcomeStatus identifies one closed structural key-decoding result.

const (
	// KeyOutcomeFound reports detached structurally valid public-key material.
	KeyOutcomeFound KeyOutcomeStatus = "found"
	// KeyOutcomeRevoked reports an explicitly empty DNS p= value.
	KeyOutcomeRevoked KeyOutcomeStatus = "revoked"
	// KeyOutcomeInvalid reports malformed supported public-key material.
	KeyOutcomeInvalid KeyOutcomeStatus = "invalid"
	// KeyOutcomeUnsupportedKeyType reports an unrecognized but syntactically valid k= value.
	KeyOutcomeUnsupportedKeyType KeyOutcomeStatus = "unsupported_key_type"
	// KeyOutcomeAlgorithmMismatch reports disagreement between requested algorithm and supported k=.
	KeyOutcomeAlgorithmMismatch KeyOutcomeStatus = "algorithm_mismatch"
	// KeyOutcomeMissing reports authoritative DNS name or data absence.
	KeyOutcomeMissing KeyOutcomeStatus = "missing"
	// KeyOutcomeAmbiguous reports multiple usable TXT resource records.
	KeyOutcomeAmbiguous KeyOutcomeStatus = "ambiguous"
	// KeyOutcomeTemporary reports an explicitly typed retryable transport failure.
	KeyOutcomeTemporary KeyOutcomeStatus = "temporary"
	// KeyOutcomePermanent reports an explicitly typed stable local failure.
	KeyOutcomePermanent KeyOutcomeStatus = "permanent"
	// KeyOutcomeProviderContract reports contradictory or unclassified injected state.
	KeyOutcomeProviderContract KeyOutcomeStatus = "provider_contract"
)

func (KeyOutcomeStatus) Known

func (s KeyOutcomeStatus) Known() bool

Known reports whether the status belongs to the closed decoder vocabulary.

type KeyType

type KeyType string

KeyType identifies one bounded DNS key type or unsupported declaration.

const (
	// KeyTypeRSA identifies RSA public-key data as PKCS#1 or SubjectPublicKeyInfo DER.
	KeyTypeRSA KeyType = "rsa"
	// KeyTypeEd25519 identifies raw Ed25519 public-key data.
	KeyTypeEd25519 KeyType = "ed25519"
	// KeyTypeMLDSA44 identifies the raw 1312-octet FIPS 204 ML-DSA-44
	// public-key encoding. DNS-02 defines no key type for pure ML-DSA-44;
	// "mldsa44" is the local interpretation that equals the Draft-09
	// Section 10.9 sig-name, as the k=/algorithm match requires
	// (DKIM2-ISSUE-0020).
	KeyTypeMLDSA44 KeyType = "mldsa44"
	// KeyTypeUnsupported records a valid but unrecognized key type without retaining spelling.
	KeyTypeUnsupported KeyType = "unsupported"
)

func (KeyType) Known

func (k KeyType) Known() bool

Known reports whether the key type belongs to the closed parser vocabulary.

type Limits

type Limits struct {
	MaxSelectorBytes       int
	MaxSelectorLabels      int
	MaxSigningDomainBytes  int
	MaxSigningDomainLabels int
	MaxOwnerBytes          int
	MaxTXTRecords          int
	MaxTXTRecordBytes      int
	MaxTags                int
	MaxTagNameBytes        int
	MaxTagValueBytes       int
	MaxDecodedKeyBytes     int
	MaxCacheEntries        int
	MaxPositiveTTL         time.Duration
	MaxNegativeTTL         time.Duration
	MaxStableErrorTTL      time.Duration
	MaxConcurrentLookups   int
	MaxCoalescedWaiters    int
	LookupTimeout          time.Duration
}

Limits bounds DNS owner, record, parser, key, cache, and lookup resources.

func DefaultLimits

func DefaultLimits() Limits

DefaultLimits returns the restrictive DNS resolver defaults.

func HardLimits

func HardLimits() Limits

HardLimits returns every declared hard maximum.

func (Limits) Validate

func (l Limits) Validate() error

Validate rejects zero, negative, or widened limits except declared cache-disable values.

type LookupResult

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

LookupResult owns one mutually exclusive found or absent TXT lookup result.

func NewAbsentResult

func NewAbsentResult(absence AbsenceClass, ttl time.Duration, dnssec DNSSECStatus) (LookupResult, error)

NewAbsentResult constructs one immutable authoritative negative result.

func NewAmbiguousResult

func NewAmbiguousResult(recordCount int, ttl time.Duration, dnssec DNSSECStatus) (LookupResult, error)

NewAmbiguousResult constructs count-only ambiguity without payload traversal. Without payloads the Section 3.7 filter cannot run, so the resolver reports such an answer as ambiguous.

func NewFoundResult

func NewFoundResult(payloads [][]byte, ttl time.Duration, dnssec DNSSECStatus) (LookupResult, error)

NewFoundResult constructs found state from raw payloads using count-first validation. Up to the hard carry bound every payload is kept, because the Draft-09 Section 3.7 version filter must inspect each record before uniqueness is decided; a larger answer is count-only ambiguity.

func (LookupResult) Absence

func (r LookupResult) Absence() AbsenceClass

Absence returns the authoritative negative class when absent.

func (LookupResult) DNSSECStatus

func (r LookupResult) DNSSECStatus() DNSSECStatus

DNSSECStatus returns verdict-neutral bounded diagnostic metadata.

func (LookupResult) IsZero

func (r LookupResult) IsZero() bool

IsZero reports whether no declared transport result is present.

func (LookupResult) NegativeTTL

func (r LookupResult) NegativeTTL() time.Duration

NegativeTTL returns authoritative negative TTL provenance.

func (LookupResult) PositiveTTL

func (r LookupResult) PositiveTTL() time.Duration

PositiveTTL returns found-answer TTL provenance.

func (LookupResult) RecordCount

func (r LookupResult) RecordCount() int

RecordCount returns the exact RR count without requiring ambiguous payload traversal.

func (LookupResult) Records

func (r LookupResult) Records() []TXTRecord

Records returns the immutable TXT payloads, or nil when absent or count-only ambiguous.

func (LookupResult) Status

func (r LookupResult) Status() LookupStatus

Status returns the mutually exclusive lookup status.

type LookupStatus

type LookupStatus string

LookupStatus identifies a mutually exclusive found or absent TXT answer.

const (
	// LookupStatusFound reports one or more TXT resource records.
	LookupStatusFound LookupStatus = "found"
	// LookupStatusAbsent reports authoritative DNS absence.
	LookupStatusAbsent LookupStatus = "absent"
)

func (LookupStatus) Known

func (s LookupStatus) Known() bool

Known reports whether the status belongs to the closed transport vocabulary.

type OwnerKind

type OwnerKind string

OwnerKind identifies the closed set of DKIM2 TXT owner shapes. The kind is derived from the owner grammar once, so selector-key and Domain Policy Record owners can never share validation drift or a cache key space.

const (
	// OwnerKindSelector identifies a key owner <selector>._domainkey.<domain>.
	// (Draft-09 Section 3.7).
	OwnerKindSelector OwnerKind = "selector"
	// OwnerKindDomainPolicy identifies a Domain Policy Record owner
	// _domainkey.<domain>. (Draft-09 Section 3.8).
	OwnerKindDomainPolicy OwnerKind = "domain_policy"
)

func ClassifyAbsoluteOwner

func ClassifyAbsoluteOwner(name string) (OwnerKind, bool)

ClassifyAbsoluteOwner validates a canonical terminal-dot DKIM2 TXT owner and reports its kind. A selector owner has at least one label before the single "_domainkey" label; a Domain Policy Record owner begins with it. Both need at least one domain label after it, and every other label must be a canonical lowercase ASCII DNS label.

func (OwnerKind) Known

func (k OwnerKind) Known() bool

Known reports whether the kind belongs to the closed owner vocabulary.

func (OwnerKind) ValidAbsoluteOwner

func (k OwnerKind) ValidAbsoluteOwner(name string) bool

ValidAbsoluteOwner reports whether name is a canonical absolute owner of exactly this kind.

type Query

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

Query owns one validated canonical DNS public-key lookup tuple.

func NewQuery

func NewQuery(signingDomain, selector string, algorithm Algorithm, limits Limits) (Query, error)

NewQuery validates canonical components and constructs absolute DNS ownership.

func (Query) AbsoluteOwner

func (q Query) AbsoluteOwner() string

AbsoluteOwner returns the canonical transport owner with a terminal root dot.

func (Query) Algorithm

func (q Query) Algorithm() Algorithm

Algorithm returns the requested supported algorithm.

func (Query) PresentationOwner

func (q Query) PresentationOwner() string

PresentationOwner returns the canonical owner without a terminal root dot.

func (Query) Selector

func (q Query) Selector() string

Selector returns the canonical ASCII selector with label boundaries preserved.

func (Query) SigningDomain

func (q Query) SigningDomain() string

SigningDomain returns the canonical ASCII signing domain.

type Record

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

Record stores one immutable bounded DNS-02 key record interpretation.

func ParseRecord

func ParseRecord(input []byte, limits Limits) (Record, error)

ParseRecord parses one already-concatenated bounded DNS-02 TXT key record.

func (Record) Draft

func (r Record) Draft() string

Draft returns the exact DNS draft behavior identifier.

func (Record) KeyType

func (r Record) KeyType() KeyType

KeyType returns the declared, default, or bounded unsupported key type.

func (Record) PublicKeyData

func (r Record) PublicKeyData() []byte

PublicKeyData returns detached decoded p= bytes for supported non-revoked records.

func (Record) Status

func (r Record) Status() RecordStatus

Status returns the closed parsed-record status.

func (Record) Valid

func (r Record) Valid() bool

Valid reports whether record state is internally coherent and parser-owned.

type RecordErrorCode

type RecordErrorCode string

RecordErrorCode identifies one bounded DNS key-record parser failure.

const (
	// RecordErrorContract reports invalid parser configuration or injected invariant state.
	RecordErrorContract RecordErrorCode = "contract"
	// RecordErrorInvalidSyntax reports malformed generic tag-list syntax.
	RecordErrorInvalidSyntax RecordErrorCode = "invalid_syntax"
	// RecordErrorLimitExceeded reports a configured record resource limit.
	RecordErrorLimitExceeded RecordErrorCode = "limit_exceeded"
	// RecordErrorInvalidVersion reports a non-first or non-DKIM1 v= tag.
	RecordErrorInvalidVersion RecordErrorCode = "invalid_version"
	// RecordErrorMissingPublicKey reports an omitted required p= tag.
	RecordErrorMissingPublicKey RecordErrorCode = "missing_public_key"
	// RecordErrorInvalidKeyType reports malformed k= hyphenated-word syntax.
	RecordErrorInvalidKeyType RecordErrorCode = "invalid_key_type"
	// RecordErrorInvalidPublicKeyData reports malformed or over-limit p= Base64 data.
	RecordErrorInvalidPublicKeyData RecordErrorCode = "invalid_public_key_data"
)

func RecordErrorCodeOf

func RecordErrorCodeOf(err error) RecordErrorCode

RecordErrorCodeOf returns a known parser code without inspecting error text.

func (RecordErrorCode) Known

func (c RecordErrorCode) Known() bool

Known reports whether the error code belongs to the closed parser vocabulary.

type RecordStatus

type RecordStatus string

RecordStatus identifies decoded key data, revocation, or unsupported key type.

const (
	// RecordStatusKeyData reports bounded decoded p= bytes for a supported key type.
	RecordStatusKeyData RecordStatus = "key_data"
	// RecordStatusRevoked reports an explicitly empty p= value.
	RecordStatusRevoked RecordStatus = "revoked"
	// RecordStatusUnsupportedKeyType reports a valid unrecognized k= value.
	RecordStatusUnsupportedKeyType RecordStatus = "unsupported_key_type"
)

func (RecordStatus) Known

func (s RecordStatus) Known() bool

Known reports whether the status belongs to the closed parser vocabulary.

type Resolver

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

Resolver owns bounded cached DNS TXT lookup, parsing, decoding, and miss coordination.

func NewResolver

func NewResolver(transport TXTTransport, limits Limits, options ...ResolverOption) (Resolver, error)

NewResolver constructs a resolver from validated immutable dependencies.

func (Resolver) Resolve

func (r Resolver) Resolve(ctx context.Context, signingDomain, selector string, algorithm Algorithm) (KeyOutcome, error)

Resolve returns one cached or coalesced TXT key outcome for a validated query.

func (Resolver) ResolveDomainPolicy

func (r Resolver) ResolveDomainPolicy(ctx context.Context, domain string) (DomainPolicyOutcome, error)

ResolveDomainPolicy returns one cached or coalesced Domain Policy Record outcome for the canonical A-label domain. It shares the transport, cache, single-flight coordination, and limits of key resolution; the policy owner grammar keeps a distinct cache key space. A context error is returned only when the caller context ended.

type ResolverOption

type ResolverOption func(*resolverConfig)

ResolverOption configures instance-owned resolver runtime dependencies.

func WithResolverClock

func WithResolverClock(clock func() time.Time) ResolverOption

WithResolverClock injects deterministic cache time.

func WithResolverParentContext

func WithResolverParentContext(parent context.Context) ResolverOption

WithResolverParentContext injects instance lifetime ownership for transport flights.

type TXTRecord

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

TXTRecord owns one already-concatenated TXT resource-record payload.

func (TXTRecord) Payload

func (r TXTRecord) Payload() []byte

Payload returns an independent copy of the TXT resource-record payload.

type TXTTransport

type TXTTransport interface {
	LookupTXT(context.Context, string) (LookupResult, error)
}

TXTTransport resolves absolute DNS TXT owners through an injected context-aware boundary.

type TransportErrorClass

type TransportErrorClass string

TransportErrorClass identifies an explicitly typed DNS transport failure.

const (
	// TransportErrorTemporary identifies retryable DNS transport failure.
	TransportErrorTemporary TransportErrorClass = "temporary"
	// TransportErrorPermanent identifies a stable local transport failure.
	TransportErrorPermanent TransportErrorClass = "permanent"
)

func TransportErrorClassOf

func TransportErrorClassOf(err error) TransportErrorClass

TransportErrorClassOf returns a known class without inspecting error text.

func (TransportErrorClass) Known

func (c TransportErrorClass) Known() bool

Known reports whether the class belongs to the closed transport failure vocabulary.

Jump to

Keyboard shortcuts

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