Documentation
¶
Overview ¶
Package vpcdns is the serving core of the Apoxy VPC name plane: a CoreDNS plugin that answers, authoritatively, for names bound into a project's VPC (tunnel endpoints today, VPC-bound Services later) and passes everything else to the next plugin in the chain (typically cache -> upstream).
The core is deliberately split from any data source: it resolves against a Snapshot the caller's Source func returns per query, so the same logic serves both the backplane's controller-runtime endpoint index and a workerd resident's pushed (ApplyDNS) state. Binding tables are per-project and small, so the per-query snapshot scan is cheap.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶
type Binding struct {
// FQDN is the name this binding answers for (no trailing dot).
FQDN string
// Addrs are the addresses the name resolves to (answered as A or AAAA by
// address family).
Addrs []netip.Addr
// Delegate forwards sub-names (x.<FQDN>) to a resolver at this binding's
// addrs instead of answering locally (recursive tunnel resolution).
Delegate bool
// TTL for answers in seconds; 0 means defaultTTL.
TTL uint32
// Reachable are the prefixes carved out of the egress SSRF backstop for
// this binding.
Reachable []netip.Prefix
}
Binding is one name bound into the project VPC: the resolvable FQDN, the addresses it answers with, and the reachability window those addresses grant through the egress SSRF backstop.
type Handler ¶
type Handler struct {
// Source returns the current name-plane snapshot; required.
Source func() Snapshot
// QueryUpstream resolves a DNS request against a single delegate upstream
// address. Nil means the default UDP-with-TCP-fallback exchange against
// the overlay-embedded resolver (upstreamHostFromAddr); tests override it.
QueryUpstream func(ctx context.Context, upstream netip.Addr, req *dns.Msg) (*dns.Msg, error)
// Metrics are the optional observation hooks.
Metrics Metrics
// Name labels this handler in plugin errors; defaults to "vpcdns".
Name string
}
Handler resolves VPC names against the Source's snapshot.
type Metrics ¶
type Metrics struct {
// Query is invoked once per handled query with the outcome:
// "hit", "recursive", "nxdomain", or "passthrough".
Query func(outcome string)
// RecursiveDuration observes one recursive resolution's duration.
RecursiveDuration func(seconds float64)
// UpstreamAbandoned counts delegate upstreams abandoned after the grace
// period.
UpstreamAbandoned func(n int)
}
Metrics are optional observation hooks; nil funcs are skipped.
type Snapshot ¶
Snapshot is one consistent view of the name plane: the zones the resolver answers authoritatively for and the current binding set. Multiple bindings may share an FQDN (one endpoint each); their addrs merge at answer time.