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§
- Resolver
Config - 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
addrover both UDP and TCP untilcancelfires. - update_
lan_ ip - Point the running responder at a new LAN address.