Serve DNS authoritative responses... with Erlang.
This application consists of three main subsystems:
-
m:erldns_zonesThe system responsible for loading and caching zone data. -
m:erldns_pipelineThe system responsible for processing incoming DNS queries, including resolution and any extension thereof. -
m:erldns_listenersThe system responsible for listening for incoming DNS queries. The system is designed to be able to listen on multiple ports and interfaces and supports both UDP and TCP, Unix network stack optimisations, and high parallelism.
There is also an administrative API for querying the current zone cache and for basic control.
You can read more about it at m:erldns_admin.
Telemetry is used to instrument the code.
All events are divided in the following namespaces:
[erldns, pipeline | _]are triggered by them:erldns_pipelinesubsystem.[erldns, request | _]are triggered by them:erldns_listenerssubsystem.
You can use this application as a standalone service or embedded into your OTP application. In both cases, you'll need to: configure it, and load zones.
Zones are loaded from JSON files in the priv/zones/ directory. The path is configured in erldns.config using the zones.path setting. For more details about zone file format and configuration, see priv/zones/ZONES.
An example configuration file can be found in erldns.example.config. For more details, see the
subsystems and the admin API documentation.
To get started, copy it into your own erldns.config and modify as needed.
To build:
makeTo start fresh:
make fresh
makeovermind startrebar3 shellrebar3 release
_build/default/rel/erldns/bin/erldns foregroundHere are some queries to try:
dig -p 8053 @127.0.0.1 example.com a
dig -p 8053 @127.0.0.1 example.com cname
dig -p 8053 @127.0.0.1 example.com ns
dig -p 8053 @127.0.0.1 example.com mx
dig -p 8053 @127.0.0.1 example.com txt
dig -p 8053 @127.0.0.1 example.com sshfp
dig -p 8053 @127.0.0.1 example.com soa
dig -p 8053 @127.0.0.1 example.com naptr
dig -p 8053 @127.0.0.1 -x 127.0.0.1 ptrIf you want to perform some benchmarks, see benchmarking.
AXFR zone transfers are not currently implemented. The current "implementation" (m:erldns_axfr) is just a stub.
To run automated tests:
make testThis runs the following: