Skip to main content

Module dns

Module dns 

Source
Expand description

Minimal loopback DNS responder for the proxy TLD.

The query shape pitchfork has to answer is fixed: “is this name under the configured TLD?”. Everything under the TLD resolves to the loopback address (or the LAN IP in LAN mode), and everything else is NXDOMAIN. That is narrow enough that a hand-rolled responder is smaller and cheaper than pulling in a full DNS server stack, so this module parses the question section directly and writes the answer back by hand.

The responder binds 127.0.0.1:<proxy.dns_port> on both UDP and TCP. It is never authoritative for anything but the configured TLD, and it never forwards: a name outside the TLD gets REFUSED, which is what lets the system resolver move on to its next server.

Structs§

ResolverConfig
What the responder answers with.

Constants§

DEFAULT_DNS_PORT
Default port for the loopback resolver.

Functions§

config_from_settings
Resolver config implied by the current settings.
dns_port
The port the resolver should listen on, clamped into range.
handle_query
Answer a DNS query.
serve
Run the responder on addr over both UDP and TCP until cancel fires.
update_lan_ip
Point the running responder at a new LAN address.