npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fuge-named

v0.0.1

Published

DNS server library for fuge, forked from node-named

Downloads

126

Readme

node-named - DNS Server in Node.js

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.

Creating a DNS Server

    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 SOARecord(domain, {serial: 12345});
      query.addAnswer(domain, target, ttl);
      server.send(query);
    });

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 fo 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 = named.SOARecord('example.com', {serial: 201205150000});
    console.log(soaRecord);

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)

Logging

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'.

TODO

  • Better record validation
  • Create DNS client for query recursor
  • Add support for PTR records
  • Add support for TCP AXFR requests

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).