{"_id":"dnsd","_rev":"21-2357bfe841e02530b57214f6ec98dd59","name":"dnsd","description":"Dynamic authoritative name server for Iris services","dist-tags":{"latest":"0.9.6"},"versions":{"0.9.0":{"name":"dnsd","description":"Dynamic authoritative name server for Iris services","keywords":["dns","bind","dnsd","iris"],"version":"0.9.0","author":{"name":"Jason Smith","email":"jhs@iriscouch.com","url":"http://www.iriscouch.com"},"repository":{"type":"git","url":"https://github.com/iriscouch/dnsd"},"engines":{"node":">= 0.8"},"main":"./named.js","dependencies":{"optimist":"~0.3.4","defaultable":"~0.7.2"},"devDependencies":{"tap":"~0.2.5"},"scripts":{"start":"node server.js"},"_id":"dnsd@0.9.0","dist":{"shasum":"2994df422863825a2648681308655a17a7251036","tarball":"https://registry.npmjs.org/dnsd/-/dnsd-0.9.0.tgz","integrity":"sha512-HFKMYK3CB7Uw+3pp1YwZfjajZ/NdjjCWWuKQWvO907wmJ2ruc8qjlGgcpwBypj3Q0UnUuxtUvwnuBODUMT5f+Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChbn4aiEWWxpe/ayowRh0BbK6fP6P+H5G9IwX8qMFvjwIhALSJUpvHp0rAtLpColmiJ6s4bazMDRkAOXX84xzUUdvl"}]},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"}]},"0.9.1":{"name":"dnsd","description":"Dynamic authoritative name server for Iris services","keywords":["dns","bind","dnsd","iris"],"version":"0.9.1","author":{"name":"Jason Smith","email":"jhs@iriscouch.com","url":"http://www.iriscouch.com"},"repository":{"type":"git","url":"https://github.com/iriscouch/dnsd"},"engines":{"node":">= 0.8"},"main":"./named.js","dependencies":{"optimist":"~0.3.4","defaultable":"~0.7.2"},"devDependencies":{"tap":"~0.2.5"},"scripts":{"test":"tap test/*.js","start":"node server.js"},"_id":"dnsd@0.9.1","dist":{"shasum":"1699fb1736cd92e52e7f833e17fe46ba538c22c4","tarball":"https://registry.npmjs.org/dnsd/-/dnsd-0.9.1.tgz","integrity":"sha512-o8zYU5PxCfC1ty+OTQ2pdBStHtRiWJdoUqVBPBgasE5q1/kCUMFUaGQSEsixDpUYwZjsJaeq9z5nlX0yReybxg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCiHlB8irPKE3XIXXwZrUH1mmu9CrL52XvU6tkqGinYdAIhAJvC6Suk96rB1d8pVundi3NtH8LtHishG2GgwLZpIz77"}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"jhs","email":"jason.h.smith@gmail.com"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"}]},"0.9.2":{"name":"dnsd","description":"Dynamic authoritative name server for Iris services","keywords":["dns","bind","dnsd","iris"],"version":"0.9.2","author":{"name":"Jason Smith","email":"jhs@iriscouch.com","url":"http://www.iriscouch.com"},"repository":{"type":"git","url":"https://github.com/iriscouch/dnsd"},"engines":{"node":">= 0.8"},"main":"./named.js","dependencies":{"optimist":"~0.3.4","defaultable":"~0.7.2"},"devDependencies":{"tap":"~0.2.5"},"scripts":{"test":"tap test/*.js","start":"node server.js"},"_id":"dnsd@0.9.2","dist":{"shasum":"e7607ea7b4fe69675760bebcb5b0ecf90d0104d8","tarball":"https://registry.npmjs.org/dnsd/-/dnsd-0.9.2.tgz","integrity":"sha512-IQt3KuoJa8gjASnx4TUaSXy+piskJwONNsINoJjt3PA3czotsezn9qeoR/6bsM1L3QFD6OL0sSNUMDbi9V6+6A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBpYlY2tHINuXxeMiwqEQRtlV/RoictoH7B4TY24Y+BfAiAp/3Z8VNQTKAc/g1GqSUNWCDip/x8CrhcjBT+qyXqZCA=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"jhs","email":"jason.h.smith@gmail.com"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"}]},"0.9.3":{"name":"dnsd","description":"Dynamic authoritative name server for Iris services","keywords":["dns","bind","dnsd","iris"],"version":"0.9.3","author":{"name":"Jason Smith","email":"jhs@iriscouch.com","url":"http://www.iriscouch.com"},"repository":{"type":"git","url":"https://github.com/iriscouch/dnsd"},"engines":{"node":">= 0.8"},"main":"./named.js","dependencies":{"optimist":"~0.3.4","defaultable":"~0.7.2"},"devDependencies":{"tap":"~0.2.5"},"scripts":{"test":"tap test/*.js","start":"node server.js"},"_id":"dnsd@0.9.3","dist":{"shasum":"090323412a70884ce52975098a48ae7d12b51ea3","tarball":"https://registry.npmjs.org/dnsd/-/dnsd-0.9.3.tgz","integrity":"sha512-W8dUB9LwUEz+VBCT+vxCPq/c9zBMbs9vVpO35cV936/qyI1LshT32Etbp56sNPT5Myj3WzVi8l3AZhvBrBllLQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGigiF34Ns3pl/CJ2Ll2188SOPEnt4/WP9eR1NDCtowJAiB0DidLnLaCVpnpabrve/fLg1BPWnu6RjT8SQtEmXCiFw=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"jhs","email":"jason.h.smith@gmail.com"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"}]},"0.9.4":{"name":"dnsd","description":"Dynamic authoritative name server for Iris services","keywords":["dns","bind","dnsd","iris"],"version":"0.9.4","author":{"name":"Jason Smith","email":"jhs@iriscouch.com","url":"http://www.iriscouch.com"},"repository":{"type":"git","url":"https://github.com/iriscouch/dnsd"},"engines":{"node":">= 0.8"},"main":"./named.js","dependencies":{"optimist":"~0.3.4","defaultable":"~0.7.2"},"devDependencies":{"tap":"~0.2.5"},"scripts":{"test":"tap test/*.js","start":"node server.js"},"_id":"dnsd@0.9.4","dist":{"shasum":"66d84f6f8db91a8fef64c19bd3b2b0677d714222","tarball":"https://registry.npmjs.org/dnsd/-/dnsd-0.9.4.tgz","integrity":"sha512-XSTGOxDQVKCOGTOEUCiZ/R+yYl6KxYCAzgi6DLzQGd2H/XO6itfPfUw/iHvSu+Wx74Xnvs3Rl3LtOqxlyedL9g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC/UdQ4u7lRgjp4YQzqAm2pV9I/bodQ3TZY1P6mLGEg1AIhALT7PLG6LTwTjFjgJlXuVqnWTIdIOtS9oF4AIT1Bc6qK"}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"jhs","email":"jason.h.smith@gmail.com"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"}]},"0.9.5":{"name":"dnsd","description":"Dynamic authoritative name server for Iris services","keywords":["dns","bind","dnsd","iris"],"version":"0.9.5","author":{"name":"Jason Smith","email":"jhs@iriscouch.com","url":"http://www.iriscouch.com"},"repository":{"type":"git","url":"https://github.com/iriscouch/dnsd"},"engines":{"node":">= 0.8"},"main":"./named.js","dependencies":{"optimist":"~0.3.4","defaultable":"~0.7.2"},"devDependencies":{"tap":"~0.2.5"},"scripts":{"test":"tap test/*.js","start":"node server.js"},"bugs":{"url":"https://github.com/iriscouch/dnsd/issues"},"homepage":"https://github.com/iriscouch/dnsd","_id":"dnsd@0.9.5","dist":{"shasum":"1c55f6248ed66541e1b65da47f5c827b709e6018","tarball":"https://registry.npmjs.org/dnsd/-/dnsd-0.9.5.tgz","integrity":"sha512-2dGFvFw0x+/LE0nhVLFWwBXBgO5sl7YTrLcE7W1NZ1+96upjFmbken3jH1W9+X40qtnQXe7lbIsm5ZxxXcA+CA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDoubzBFVBr3KNbhc2Qz73qqVpVH15pvij+uB+evMuBAQIgAWw/wc1znYlRnoiECYQ2Adp4yVG/NR6mBZTX7kqPavo="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"jhs","email":"jhs@iriscouch.com"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"}]},"0.9.6":{"name":"dnsd","description":"Dynamic authoritative name server for Iris services","keywords":["dns","bind","dnsd","iris"],"version":"0.9.6","author":{"name":"Jason Smith","email":"jason.h.smith@gmail.com"},"repository":{"type":"git","url":"https://github.com/jhs/dnsd"},"licenses":[{"type":"Apache 2.0","url":"https://github.com/jhs/dnsd/blob/master/LICENSE"}],"engines":{"node":">= 0.8"},"main":"./named.js","dependencies":{"optimist":"~0.3.4","defaultable":"~0.7.2"},"devDependencies":{"tap":"~0.2.5"},"scripts":{"test":"tap test/*.js","start":"node server.js"},"gitHead":"9b523ac3c8f54a630d3e5d9045ee8626e5f82ffb","bugs":{"url":"https://github.com/jhs/dnsd/issues"},"homepage":"https://github.com/jhs/dnsd","_id":"dnsd@0.9.6","_shasum":"eee58201602b7039dab44ef9de7f771f0cfcf874","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"jhs","email":"jhs@iriscouch.com"},"maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"}],"dist":{"shasum":"eee58201602b7039dab44ef9de7f771f0cfcf874","tarball":"https://registry.npmjs.org/dnsd/-/dnsd-0.9.6.tgz","integrity":"sha512-aqdRHXZU+qPyD97PMEHJHXtEFGQi2ssgn8mMsVxJt5zC/uVVQ9uGx8sjTZckHYpuiP2H7wmJ5Jcg2PRYTFHUWw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEwnEmMbe+LAgGFcYujGFz58NGTuujts/uDQqTm8HYQpAiBHiv2hZ2p6+Pn/GETfCoXmLsiwJERgLulhIUglcb2BIw=="}]}}},"readme":"# dnsd: DNS encoder, decoder, and server\n\n*dnsd* is a Node.js package for working with DNS. It converts binary DNS messages to and from convenient JavaScript objects; and it provides a server API, for running a custom name server.\n\n*dnsd* is available as an npm module.\n\n    $ npm install dnsd\n\n## Example: Running a server\n\nThis simple DNS server responds with an \"A\" (address) record of `1.2.3.4` for every request.\n\n```javascript\nvar dnsd = require('dnsd')\ndnsd.createServer(function(req, res) {\n  res.end('1.2.3.4')\n}).listen(5353, '127.0.0.1')\nconsole.log('Server running at 127.0.0.1:5353')\n```\n\nNow test your server:\n\n    $ dig @localhost -p 5353 foo.example A\n\n    ; <<>> DiG 9.8.1-P1 <<>> @localhost -p 5353 foo.example A\n    ; (1 server found)\n    ;; global options: +cmd\n    ;; Got answer:\n    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27955\n    ;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0\n    ;; WARNING: recursion requested but not available\n\n    ;; QUESTION SECTION:\n    ;foo.example.\t\t\tIN\tA\n\n    ;; ANSWER SECTION:\n    foo.example.\t\t3600\tIN\tA\t1.2.3.4\n\n    ;; Query time: 1 msec\n    ;; SERVER: 127.0.0.1#5353(127.0.0.1)\n    ;; WHEN: Wed Aug  8 05:10:40 2012\n    ;; MSG SIZE  rcvd: 45\n\nThis example logs all requests. For address (A) queries, it returns two records, with a random TTL, and the final octet of the IP address is the length of the hostname queried.\n\n```javascript\nvar dnsd = require('dnsd')\n\nvar server = dnsd.createServer(handler)\nserver.zone('example.com', 'ns1.example.com', 'us@example.com', 'now', '2h', '30m', '2w', '10m')\n      .listen(5353, '127.0.0.1')\nconsole.log('Server running at 127.0.0.1:5353')\n\nfunction handler(req, res) {\n  console.log('%s:%s/%s %j', req.connection.remoteAddress, req.connection.remotePort, req.connection.type, req)\n\n  var question = res.question[0]\n    , hostname = question.name\n    , length = hostname.length\n    , ttl = Math.floor(Math.random() * 3600)\n\n  if(question.type == 'A') {\n    res.answer.push({name:hostname, type:'A', data:\"1.1.1.\"+length, 'ttl':ttl})\n    res.answer.push({name:hostname, type:'A', data:\"2.2.2.\"+length, 'ttl':ttl})\n  }\n  res.end()\n}\n```\n\nTest the SOA response:\n\n    $ dig @localhost -p 5353 example.com soa\n\n    ; <<>> DiG 9.8.1-P1 <<>> @localhost -p 5353 example.com soa\n    ; (1 server found)\n    ;; global options: +cmd\n    ;; Got answer:\n    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30176\n    ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0\n    ;; WARNING: recursion requested but not available\n\n    ;; QUESTION SECTION:\n    ;example.com.\t\t\tIN\tSOA\n\n    ;; ANSWER SECTION:\n    example.com.\t\t600\tIN\tSOA\tns1.example.com. us.example.com. 1344403648 7200 1800 1209600 600\n\n    ;; Query time: 5 msec\n    ;; SERVER: 127.0.0.1#5353(127.0.0.1)\n    ;; WHEN: Wed Aug  8 05:27:32 2012\n    ;; MSG SIZE  rcvd: 72\n\nAnd test the address (A) response:\n\n    $ dig @localhost -p 5353 example.com a\n\n    ; <<>> DiG 9.8.1-P1 <<>> @localhost -p 5353 example.com a\n    ; (1 server found)\n    ;; global options: +cmd\n    ;; Got answer:\n    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19419\n    ;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0\n    ;; WARNING: recursion requested but not available\n\n    ;; QUESTION SECTION:\n    ;example.com.\t\t\tIN\tA\n\n    ;; ANSWER SECTION:\n    example.com.\t\t1222\tIN\tA\t1.1.1.11\n    example.com.\t\t1222\tIN\tA\t2.2.2.11\n\n    ;; Query time: 1 msec\n    ;; SERVER: 127.0.0.1#5353(127.0.0.1)\n    ;; WHEN: Wed Aug  8 05:27:34 2012\n    ;; MSG SIZE  rcvd: 61\n\nServer output for these queries:\n\n    Server running at 127.0.0.1:5353\n    127.0.0.1:34427/udp4 {\"id\":30176,\"type\":\"request\",\"responseCode\":0,\"opcode\":\"query\",\"authoritative\":false,\"truncated\":false,\"recursion_desired\":true,\"recursion_available\":false,\"authenticated\":false,\"checking_disabled\":false,\"question\":[{\"name\":\"example.com\",\"type\":\"SOA\",\"class\":\"IN\"}]}\n    127.0.0.1:59596/udp4 {\"id\":19419,\"type\":\"request\",\"responseCode\":0,\"opcode\":\"query\",\"authoritative\":false,\"truncated\":false,\"recursion_desired\":true,\"recursion_available\":false,\"authenticated\":false,\"checking_disabled\":false,\"question\":[{\"name\":\"example.com\",\"type\":\"A\",\"class\":\"IN\"}]}\n\n\n## Example: MX Records\nThis is an example if you need to route your mail server with an MX record.\n\n```javascript\n// Example MX response with dnsd\n//\n// To test:\n// 1. Run this program\n// 2. dig @localhost -p 5353 example.com mx\n \nvar dnsd = require('dnsd')\n \nvar server = dnsd.createServer(handler)\nserver.zone('example.com', 'ns1.example.com', 'us@example.com', 'now', '2h', '30m', '2w', '10m')\nserver.listen(5353, '127.0.0.1')\nconsole.log('Listening at 127.0.0.1:5353')\n \nfunction handler(req, res) {\n  var question = res.question && res.question[0]\n \n  if(question.type != 'MX')\n    return res.end()\n \n  console.log('MX lookup for domain: %s', question.name)\n  res.answer.push({'name':question.name, 'type':'MX', 'data':[10, 'mail.example.com']})\n  res.answer.push({'name':question.name, 'type':'MX', 'data':[20, 'mail.backupexample.com']})\n  \n  return res.end()\n}\n```\n\nThe MX data attribute needs to be an Array to work properly, the first value is the priority, the second is the server.\nThis server name must be a domain string and not an IP address. Make sure you have an A record or CNAME setup for this.\n\nSee http://support.google.com/a/bin/answer.py?hl=en&answer=140034 for more info on MX records and configuration.\n\n\n\n## Example: Parse a message\n\n```javascript\nvar fs = require('fs')\nvar dnsd = require('dnsd')\n\nvar msg_file = require.resolve('dnsd/_test_data/registry.npmjs.org-response')\n  , msg_data = fs.readFileSync(msg_file)\n  , message = dnsd.parse(msg_data)\n\nconsole.dir(message)\n```\n\nOutput\n\n```javascript\n{ id: 34233,\n  type: 'response',\n  responseCode: 0,\n  opcode: 'query',\n  authoritative: false,\n  truncated: false,\n  recursion_desired: true,\n  recursion_available: true,\n  authenticated: false,\n  checking_disabled: false,\n  question: [ { name: 'registry.npmjs.org', type: 'A', class: 'IN' } ],\n  answer:\n   [ { name: 'registry.npmjs.org',\n       type: 'CNAME',\n       class: 'IN',\n       ttl: 85,\n       data: 'isaacs.iriscouch.net' },\n     { name: 'isaacs.iriscouch.net',\n       type: 'CNAME',\n       class: 'IN',\n       ttl: 2821,\n       data: 'ec2-23-23-147-24.compute-1.amazonaws.com' },\n     { name: 'ec2-23-23-147-24.compute-1.amazonaws.com',\n       type: 'A',\n       class: 'IN',\n       ttl: 356336,\n       data: '23.23.147.24' } ] }\n```\n\n## Example: Encode a message\n\n```javascript\nvar dnsd = require('dnsd')\n\nvar questions = [ {name:'example.com', class:'IN', type:'TXT'} ]\n  , message = {type:'query', id:123, opcode:'query', recursion_desired:true, question:questions}\n  , msg_data = dnsd.binify(message)\n\nconsole.log('Encoded = %j', Array.prototype.slice.apply(msg_data))\n\nmessage = dnsd.parse(msg_data)\n\nconsole.log('Round trip:')\nconsole.dir(message)\n```\n\nOutput:\n\n```javascript\nEncoded = [0,123,1,0,0,1,0,0,0,0,0,0,7,101,120,97,109,112,108,101,3,99,111,109,0,0,16,0,1]\nRound trip:\n{ id: 123,\n  type: 'request',\n  responseCode: 0,\n  opcode: 'query',\n  authoritative: false,\n  truncated: false,\n  recursion_desired: true,\n  recursion_available: false,\n  authenticated: false,\n  checking_disabled: false,\n  question: [ { name: 'example.com', type: 'TXT', class: 'IN' } ] }\n```\n\n## Defaults\n\n`dnsd` is [defaultable][def]. The option `convenient` (`true` by default) adds convenience code when running a server.  Convenience mode adds several features, mostly to build standards-compliant name servers.\n\n```javascript\nvar dnsd_easy = require('dnsd')\nvar dnsd_hard = dnsd_easy.defaults({convenient: false})\n```\n\nFirst, your handler's response object already has `.type = \"response\"` set; then there are many helpers processing your response:\n\n* You can pass a value to `res.end()`, with special handling depending on type:\n  * Array: those values will be added to the `res.answer` section.\n  * Object: that object will be sent as a response (`res` is unused).\n  * String: the response will add an anser `A` record with your value as the IP address.\n* Automatically respond to `SOA` queries with the `SOA` record.\n* Responses to an `A` query with no answers will add the `SOA` record to the response.\n* If the response records are missing a TTL, use the one from the `.zone()` definition (the `SOA` record)\n\nWithout convenience mode, dnsd will simply send your response verbatim, as you define it (or throw an encoding error for missing or bad data).\n\n## Tests\n\nFollow uses [node-tap][tap]. If you clone this Git repository, tap is included.\n\n    $ tap test\n    ok test/api.js ........................................ 10/10\n    ok test/convenience.js ................................ 22/22\n    ok test/message.js .................................. 176/176\n    ok test/print.js ...................................... 10/10\n    ok test/server.js ..................................... 35/35\n    total ............................................... 253/253\n\n    ok\n\n## License\n\nApache 2.0\n\nSee the [Apache 2.0 license](dnsd/blob/master/LICENSE).\n\n[tap]: https://github.com/isaacs/node-tap\n[def]: https://github.com/iriscouch/defaultable\n","maintainers":[{"name":"jhs","email":"jhs@iriscouch.com"}],"time":{"modified":"2022-06-15T06:24:17.698Z","created":"2013-01-30T19:34:11.118Z","0.9.0":"2013-01-30T19:34:16.863Z","0.9.1":"2013-09-06T17:47:25.124Z","0.9.2":"2013-09-07T16:06:12.939Z","0.9.3":"2013-09-10T05:43:53.517Z","0.9.4":"2013-09-10T09:07:35.993Z","0.9.5":"2014-08-28T16:03:56.766Z","0.9.6":"2015-04-15T02:37:17.334Z"},"author":{"name":"Jason Smith","email":"jason.h.smith@gmail.com"},"repository":{"type":"git","url":"https://github.com/jhs/dnsd"},"homepage":"https://github.com/jhs/dnsd","keywords":["dns","bind","dnsd","iris"],"bugs":{"url":"https://github.com/jhs/dnsd/issues"},"readmeFilename":"README.md","users":{"gammasoft":true,"senorsen":true,"brandonpapworth":true}}