{"name":"dns-socket","version":"4.2.2","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.2.4"},"devDependencies":{"eslint":"^5.12.1","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.15.0","eslint-plugin-node":"^8.0.1","eslint-plugin-promise":"^4.0.1","eslint-plugin-standard":"^4.0.0","tape":"^4.9.2"},"keywords":["dns","domain","socket","low-level"],"gitHead":"2f0a0b434c5df0d82b0b8004f5ea52df15d890ba","bugs":{"url":"https://github.com/mafintosh/dns-socket/issues"},"_id":"dns-socket@4.2.2","_nodeVersion":"16.1.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-BDeBd8najI4/lS00HSKpdFia+OvUMytaVjfzR9n5Lq8MlZRSvtbI+uLtx1+XmQFls5wFU9dssccTmQQ6nfpjdg==","shasum":"58b0186ec053ea0731feb06783c7eeac4b95b616","tarball":"http://registry-npm.ywwl.com/dns-socket/download/dns-socket-4.2.2.tgz","fileCount":4,"unpackedSize":11995,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgsVOdCRA9TVsSAnZWagAA6zMP/RxzHWuz7lVDtD6BCTRb\ny3zSgT0JwVbvOZE2xeVYZmF3chphGjZ/Z+VAEDAxDiG0Dlgxt+PFU4Og08zH\nc2gnHG/OtHkziZ3k2zg708UNXYkVqdtZ4orrHlpyH/inOzzP6/o2ui0aKPz8\nhbPiEr8dv+ayU5elOu3BxZ0f9uExe00wQSaDT/drNvRjE03V2fltMWYUB+co\nIEd/ox5vaBBxR+Jljuk0Ooknco6pjxumAxD5He86uQWpCnr+L5M4EfGffQ95\nLcMNsSsFEBrCdClfeA3l1h7kZFg3nyzngxNkz0YYbyiU1jrMemkyWLXUMZAH\n0tI6Z45sdgIACvvxEdokqV0zVhoUOAkPjCr73Vj/rBmFD+oyd0Ktc9wUiItC\np41GaH6sjcyknJ+2FWPEaBwVx2AQ0MvDEY4eOHmrd1BUkCRmRo2saz1Wfs/t\n/YRgrl7/MH9J9qkYAvQ7dmjMPERVR+kyY49xfg2/30oozl3Ws4g9QDQwzz3/\nYL5pNSbs6YkENFBiaRlSBZ7H6SCyPuwdHQ9Bz0r/Qzs78s1qmXukxLHn+nnH\n5BwEAcKmXww0V1VZOZAZ1HwyjbJ+3mlMebZCgRzlTxz8FE8uQnwZJIlD/jh2\nHGxroK5teuoij+b96xVZjB0X3fcBEPwcdO0dS5IO7/LApTewPlT4RGCanrIf\no9nw\r\n=I+Zn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCkCaeuEVfLJVbBEtuI9CeYrKZ6N3/te+4DbQuQZd6OzAIgao5cwP//lrOjLgFXjK9x/4wXB3OrYVIodL5XojHrsbw="}],"size":4412,"noattachment":false,"key":"/dns-socket/-/dns-socket-4.2.2.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"silverwind","email":"npm@silverwind.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dns-socket_4.2.2_1622234013228_0.5373639941263495"},"_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":1622234013378,"_cnpm_publish_time":1622234013378,"dist-tags":{"latest":"4.2.2"}}