Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@daguej/named
Advanced tools
Node-named is a lightweight DNS server written in pure javascript. It has limited support for the DNS spec, but aims to implement all of the common functionality that is in use today.
** This project is not actively maintained ** I've received a lot of great PRs for this project, but I don't have the capacity to actively maintain this library at the moment. I feel strongly about maintaining backwards compatibility for people who rely on it, so any PRs would also need to adhere to keeping the API sane, or contribute to some improvement in performance.
var named = require('./lib/index');
var server = named.createServer();
var ttl = 300;
server.listen(9999, '127.0.0.1', function() {
console.log('DNS server started on port 9999');
});
server.on('query', function(query) {
var domain = query.name();
console.log('DNS Query: %s', domain)
var target = new named.SOARecord(domain, {serial: 12345});
query.addAnswer(domain, target, ttl);
server.send(query);
});
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', 'NS', '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 = require('node-named');
var soaRecord = new named.SOARecord('example.com', {serial: 201205150000});
console.log(soaRecord);
The following record types are supported
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.
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'.
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).
There are a few handy ways to lookup DNS records in node. https://github.com/LCMApps/dns-lookup-cache
FAQs
DNS server library for node.js
We found that @daguej/named demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.