node-mname - DNS Server in Node.js
mname is a fork of the
node-named library, which enables the development of
DNS servers in node.js.
This fork adds the following features:
- Queries over TCP connections
- AXFR, IXFR zone transfers
- PTR records
- Name compression
- EDNS 1.0
Creating a DNS Server
var named = ;var server = named;var ttl = 300;server;server;
Creating DNS Records
node-named provides helper functions for creating DNS records. The records are available under 'named.record.NAME' where NAME is one of ['A', 'AAAA', 'CNAME', 'SOA', 'MX', 'TXT, 'SRV']. It is important to remember that these DNS records are not permanently added to the server. They only exist for the length of the particular request. After that, they are destroyed. This means you have to create your own lookup mechanism.
var named = ;var soaRecord = named;console;
Supported Record Types
The following record types are supported
- A (ipv4)
- AAAA (ipv6)
- CNAME (aliases)
- SOA (start of authority)
- MX (mail server records)
- TXT (arbitrary text entries)
- SRV (service discovery)
node-named uses http://github.com/trentm/node-bunyan for logging. It's a lot nicer to use if you npm install bunyan and put the bunyan tool in your path. Otherwise, you will end up with JSON formatted log output by default.
Replacing the default logger
You can pass in an alternate logger if you wish. If you do not, then it will use bunyan by default. Your logger must expose the functions 'info', 'debug', 'warn', 'trace', 'error', and 'notice'.
Tell me even more...
When DNS was designed it was designed prior to the web existing, so many of the features in the RFC are either never used, or were never implemented. This server aims to be RFC compliant, but does not implement any other protocol other than INET (the one we're all used to), and only supports a handful of record types (the ones that are in use on a regular basis).