GithubHelp home page GithubHelp logo

isabella232 / node-mname Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tritondatacenter/node-mname

0.0 0.0 0.0 369 KB

Fork of node-named (DNS server in node.js) with AXFR, IXFR, TCP support and more

License: MIT License

Makefile 14.72% JavaScript 85.28%

node-mname's Introduction

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 = require('./lib/index');
var server = named.createServer();
var ttl = 300;

server.listenUdp(9999, '127.0.0.1', function() {
  console.log('DNS server started on port 9999');
});

server.on('query', function(query, done) {
  var domain = query.name();
  console.log('DNS Query: %s', domain)
  var target = new SOARecord(domain, {serial: 12345});
  query.addAnswer(domain, target, ttl);
  query.respond();
  done();
});

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

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

node-mname's People

Contributors

arekinath avatar trevoro avatar lorenz avatar brianin3d avatar cburroughs avatar jclulow avatar demmer avatar rhb2 avatar trentm avatar cyberglot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.