{"name":"dns-socket","version":"4.1.0","description":"Make low-level DNS requests with retry and timeout support.","author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mafintosh/dns-socket.git"},"homepage":"https://github.com/mafintosh/dns-socket","engines":{"node":">=6"},"scripts":{"test":"eslint --color *.js && tape test.js"},"dependencies":{"dns-packet":"^5.0.1"},"devDependencies":{"eslint":"^5.0.1","eslint-config-standard":"^11.0.0","eslint-plugin-import":"^2.13.0","eslint-plugin-node":"^6.0.1","eslint-plugin-promise":"^3.8.0","eslint-plugin-standard":"^3.1.0","tape":"^4.9.1"},"keywords":["dns","domain","socket","low-level"],"files":["index.js"],"gitHead":"e77a4feb0c40bc51f19997cc085dd631148c9599","bugs":{"url":"https://github.com/mafintosh/dns-socket/issues"},"_id":"dns-socket@4.1.0","_npmVersion":"6.1.0","_nodeVersion":"10.5.0","_npmUser":{"name":"silverwind","email":"npm@silverwind.io"},"dist":{"integrity":"sha512-rUs/Lf5vF/LA/O2J1KD5Dk93mWdlInDV8vX1e2vKQ5NDp3M8lvZUnPibvRrnJd1TowrMR2XDb5tLSHpXrfYyFg==","shasum":"3fecd911c4aa81cfcda15c67eebbee5f972a6142","tarball":"http://registry-npm.ywwl.com/dns-socket/download/dns-socket-4.1.0.tgz","fileCount":5,"unpackedSize":10850,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbO61gCRA9TVsSAnZWagAAfVUP/j45jBf3CgqbDTo1tp8C\nOlkHgZhSGUxXg4WqA4KgN//F8zOeA61B38j9ChU09ok0O+OOwqkItaiQRmtj\noiKN0sjkVtu+71brDHvYE1OY2fD3xlshjZQiac/LFLzTIDTiCgajl34VeCli\n3Fu36AkpkErhfP+V8dzJ5CDB8u3Sda3AfFmjktoWoPe4LmSzdVPxSCZ5VWKW\nA7vEVLeK8vWG/L+o2feD91C3ZZmCat3y2BpMJ0X/E6kIQRDgS5wnhRjnLoiX\npJWNLnQVtDbbus3PiFUoIZ43N1YRWj8Or7nRrIrWHO/hV9z2DnVJ80z4mHsM\nDNofs2gR27+k/BbEipv2FY9RxQ5nZi8OFbvyBHDC7Os22P8dN4tiRsHDmRqE\nXuUj6tIhqmG1c2UgDzHhVeJSK9dgbU1JVdEOUMY+XovjyYMqPRgHu6d2Owho\nAbqekfn6ImTl6Wj+JyKJNnJOwMuE/Zzh2GPf6xAWulfeSk3C/8MahMJaScxf\nIFJYQjKSqLEpGPXSE9Wa5r+whal5Q9lxigWpPJTUab26nXjeE7qGFlgtqXwF\nPDvXzNQBnckPjHDNntSU3B5EQ/Nk8AqeGshU/8SmTdpMhT7oZjVbEF976oIi\nIqSGVrFJRJC5jkkuDr+xPlOzCnHWoYNWajRZzmXL7H79h/4sHCyvGbN6lEq4\nESS5\r\n=K5np\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFMNuaplNBnr0xpFlOVVx1BhOoA7906UqKi3lIhlJxVUAiBPDanKx37c9AwRNwNeQQ5W45QJmVxhmuPlcI37YgunwQ=="}],"size":4172,"noattachment":false,"key":"/dns-socket/-/dns-socket-4.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"silverwind","email":"npm@silverwind.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dns-socket_4.1.0_1530637664927_0.5264510106600839"},"_hasShrinkwrap":false,"readme":"# dns-socket\n[![](https://img.shields.io/npm/v/dns-socket.svg?style=flat)](https://www.npmjs.org/package/dns-socket) [![](https://img.shields.io/npm/dm/dns-socket.svg)](https://www.npmjs.org/package/dns-socket) [![](https://api.travis-ci.org/mafintosh/dns-socket.svg?style=flat)](https://travis-ci.org/mafintosh/dns-socket)\n\nMake low-level DNS requests with retry and timeout support.\n\n```\nnpm install dns-socket\n```\n\n## Usage\n\n``` js\nconst dnsSocket = require('dns-socket')\nconst socket = dnsSocket()\n\nsocket.query({\n  questions: [{\n    type: 'A',\n    name: 'google.com'\n  }]\n}, 53, '8.8.8.8', (err, res) => {\n  console.log(err, res) // prints the A record for google.com\n})\n```\n\n## API\n\n#### `var socket = dns([options])`\n\nCreate a new DNS socket instance. The `options` object includes:\n\n- `retries` *Number*: Number of total query attempts made during `timeout`. Default: 5.\n- `socket` *Object*: A custom dgram socket. Default: A `'udp4'` socket.\n- `timeout` *Number*: Total timeout in milliseconds after which a `'timeout'` event is emitted. Default: 7500.\n- `maxQueries` *Number*: Each request has an id, this is stored as static sized array. maxQueries is the size of this array, limiting the max number of inflight requests. Default: 10000.\n- `maxRedirects` *Number*: If you query for a single `A` record and get back `CNAME`, the lib will try to follow the chain and resolve the `CNAME` to A. The maximum number of steps is defined by the `maxRedirects`. Default: 0\n- `timeoutChecks` *Number*: Timeouts are checked each `timeoutChecks` ms, for large number of parallel request, you might want to increase this number. Default: `timeout` / 10\n\n#### `socket.on('query', query, port, host)`\n\nEmitted when a dns query is received. The query is a [dns-packet](https://github.com/mafintosh/dns-packet)\n\n#### `socket.on('response', response, port, host)`\n\nEmitted when a dns response is received. The response is a [dns-packet](https://github.com/mafintosh/dns-packet)\n\n#### `var id = socket.query(query, port, [host], [callback])`\n\nSend a dns query. If host is omitted it defaults to `127.0.0.1`. When the remote replies the callback is called with `(err, response, query)` and an response is emitted as well. If the query times out the callback is called with an error.\nThe `host` parameter can be an array, during resolve the lib will randomly select one host.\n\nReturns the query id\n\n#### `socket.response(query, response, port, [host])`\n\nSend a response to a query.\n\n#### `socket.cancel(id)`\n\nCancel a query\n\n#### `socket.bind([port][, address][, onlistening])`\n#### `socket.bind(options, [onlistening])`\n\nBind the underlying udp socket to a specific port. Takes the same arguments as [socket#bind](https://nodejs.org/docs/latest/api/dgram.html#dgram_socket_bind_port_address_callback).\n\n#### `socket.destroy([onclose])`\n\nDestroy the socket.\n\n#### `socket.inflight`\n\nNumber of inflight queries.\n\n## License\n\nMIT\n","publish_time":1530637664993,"_cnpm_publish_time":1530637664993,"dist-tags":{"latest":"4.2.2"}}