appload-dns

DNS library in node.js

npm install appload-dns
5 downloads in the last week
9 downloads in the last month

Appload DNS

Fork of ndns by Jeremy Johnstone created for Appload platform.

Example in Coffeescript:

dns = require "appload-dns"
zones =
  "appload.pl":
    admin: "rafal@appload.pl"
    records: [
      {class: "A", value: "192.168.1.100"}
      {class: "NS", value: "dns1.appload.pl."}
      {class: "NS", value: "dns2.appload.pl."}
      {prefix: "dns1", value: "192.168.1.100"}
      {prefix: "dns2", value: "192.168.1.101"}
      {prefix: "sample", value: "192.168.1.104"}
      {prefix: "another-sample", value: "192.168.1.105"}
      {class: "MX", value: "10 aspmx.l.google.com."}
      {class: "TXT", value: "hello npm"}
    ]
  "zaqpki.pl":
    admin: "rafal@appload.pl"
    records: [
      {class: "NS", value: "dns1.zaqpki.pl."}
      {class: "NS", value: "dns2.zaqpki.pl."}
      {prefix: "dns1", value: "192.168.1.100"}
      {prefix: "dns2", value: "192.168.1.101"}
      {class: "A", value: "192.168.1.100"}
    ]

server = dns.createServer(zones)
server.listen(53)

Zones configuration can be replaced in real-time by reload method.

server.reload(zones)

Connection can be closed by close method.

server.close()
npm loves you