dns

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package dns implements the wildcard DNS server and the host-resolver wiring that route the configured TLD to the local proximo.

Index

Constants

This section is empty.

Variables

View Source
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

func ConfigureResolver(r platform.Runner, tld string) error

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 QueryLocal added in v0.13.0

func QueryLocal(ctx context.Context, name string) (string, error)

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

func RemoveResolver(r platform.Runner, tld string) error

RemoveResolver removes the host resolver configuration created by ConfigureResolver and reloads the resolver.

func ResolverPath added in v0.13.0

func ResolverPath(tld string) (string, error)

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

func Sentinel(tld string) string

Sentinel is the name a Check resolves to prove DNS works, e.g. proximo-doctor.test.

func SystemResolves added in v0.13.0

func SystemResolves(ctx context.Context, name string) (string, error)

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
	// 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.

func (*Server) Run

func (s *Server) Run() error

Run starts the UDP and TCP listeners and blocks until one of them fails.

Jump to

Keyboard shortcuts

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