Documentation
¶
Overview ¶
Package dns implements the wildcard DNS server and the host-resolver wiring that route the configured TLD to the local proximo.
Index ¶
- Variables
- func ConfigureResolver(r platform.Runner, tld string) error
- func QueryAt(ctx context.Context, server, name string) (string, error)
- func QueryLocal(ctx context.Context, name string) (string, error)
- func RemoveResolver(r platform.Runner, tld string) error
- func ResolverPath(tld string) (string, error)
- func ResolverRemedy() string
- func Sentinel(tld string) string
- func SystemResolves(ctx context.Context, name string) (string, error)
- type Server
Constants ¶
This section is empty.
Variables ¶
var DefaultUpstream = []string{"1.1.1.1:53", "8.8.8.8:53"}
DefaultUpstream is used when no upstream resolver is configured.
Functions ¶
func ConfigureResolver ¶
ConfigureResolver wires the host resolver so that lookups for the TLD are sent to the local DNS server on 127.0.0.1:<DNSPort>. Privileged writes go through the injected Runner so the install step is testable.
func QueryAt ¶ added in v0.16.0
QueryAt asks the DNS server at server (host:port) directly for name's A record, and returns the address it answered with (empty when it answered nothing) — the peer listener on the mesh address, or the loopback one.
func QueryLocal ¶ added in v0.13.0
QueryLocal asks the proximo DNS server directly, bypassing the host resolver, and returns the address it answered with (empty when it answered nothing). This is the half of the DNS answer that says whether the server itself is alive; SystemResolves is the half that says whether the host uses it.
func RemoveResolver ¶
RemoveResolver removes the host resolver configuration created by ConfigureResolver and reloads the resolver.
func ResolverPath ¶ added in v0.13.0
ResolverPath is the host file that points the TLD at proximo's DNS server — the file ConfigureResolver writes. A Check reads it to tell a machine that was never installed from one whose resolver was removed.
func ResolverRemedy ¶ added in v0.13.0
func ResolverRemedy() string
ResolverRemedy is the command whose own output names why the host resolver is not using proximo's DNS server. There is no cure to offer — a VPN's scoped resolver outranking the proximo one is not something proximo may undo — so the remedy is the question.
func Sentinel ¶ added in v0.13.0
Sentinel is the name a Check resolves to prove DNS works, e.g. proximo-doctor.test.
func SystemResolves ¶ added in v0.13.0
SystemResolves asks the host resolver — through the OS tool that honours the scoped resolver configuration — and returns the address it answered with.
Go's own net.LookupHost is deliberately not used: the pure resolver reads /etc/resolv.conf and honours neither /etc/resolver/<tld> on macOS nor a Domains=~<tld> drop-in on Linux, so it would report a failure on a perfectly healthy machine.
Types ¶
type Server ¶
type Server struct {
// TLD is the routed top-level domain without a leading dot (e.g. "test").
TLD string
// Addr is the listen address (e.g. ":5353").
Addr string
// Upstream is the list of upstream resolvers as host:port.
Upstream []string
// PeerSubtree, when set, makes this the peer listener instead: it answers
// this machine's peer subtree (<machine>.<suffix>) with PeerAddress and
// refuses every other name. The loopback listener never sets it — the two
// are kept apart by container port, since Docker Desktop rewrites the
// source address of a published port.
PeerSubtree string
PeerAddress net.IP
// contains filtered or unexported fields
}
Server answers wildcard queries for a TLD with a loopback address and forwards every other query to an upstream resolver.