How auv888/dns_relay works
SND is a single-threaded DNS relay with local caching, upstream forwarding, configurable runtime modes, and binary event logging. The main workflow is client query → local lookup or upstream relay → client response; startup parses options, initializes sockets and cache, and optionally loads cached records. The graph also includes log parsing and DNS wire-format support. Some server and parser implementation is excerpted only partially, so edges to their dependencies rely on the shown calls, SOURCE INDEX references, or README statements rather than a full source review.
Main entry points: DNS_server.c Socket event loop · main.c Program entry · DNS_arguments.c CLI and cache loader · DNS_convert.c DNS codec
Components 13
Startup and configuration
- Program entry
src/main.c - CLI and cache loader
src/DNS_arguments.c
DNS relay
- Socket event loop
src/DNS_server.c - DNS codec
src/DNS_convert.c - DNS message types
include/DNS_struct.h
Runtime support
- DNS cache
src/DNS_cache.c - Transaction ID map
src/DNS_id.c
Logging and analysis
- Binary event logger
src/DNS_debug.c - Log parser
src/DNS_logparser.c
Other components
- Operator
- DNS clients
- Upstream DNS
- Binary log file
Connections 17
- Operator → Program entry: starts
README.md - Program entry → CLI and cache loader: parses options
src/main.c - Program entry → Socket event loop: initializes and runs
src/main.c - Program entry → CLI and cache loader: loads cache file
src/main.c - DNS clients → Socket event loop: sends queries
README.md - Socket event loop → DNS codec: decodes and encodes
src/DNS_server.c - DNS codec → DNS message types: uses structures
src/DNS_convert.c - Socket event loop → DNS cache: looks up and updates
src/DNS_server.c - CLI and cache loader → DNS cache: inserts loaded records
src/DNS_arguments.c - Socket event loop → Transaction ID map: tracks forwarded queries
src/DNS_server.c - Socket event loop → Upstream DNS: forwards queries
README.md - Upstream DNS → Socket event loop: returns answers
README.md - Socket event loop → DNS clients: replies
README.md - Socket event loop → Binary event logger: writes events
src/DNS_server.c - Binary event logger → Binary log file: writes binary records
- Operator → Log parser: runs on logs
src/DNS_logparser.c - Binary log file → Log parser: provides input
src/DNS_logparser.c