{"name":"dns-socket","version":"4.1.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.1.1"},"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":"d8ff2ac992d5cc794378f4aa057a4929f0f71ce6","bugs":{"url":"https://github.com/mafintosh/dns-socket/issues"},"_id":"dns-socket@4.1.2","_nodeVersion":"11.7.0","_npmVersion":"6.6.0","dist":{"integrity":"sha512-CZUsdoBxDd6KWZ0F7MfmVklMQW826s7ueRiRRylAiaENy+yZEOC0Qe9U+L1ijHD6kyYEhQYHZD0EPeQ1U1fFww==","shasum":"9c2e9ab112c3a67985aafe806b5e8aae1fd6c3f6","tarball":"http://registry-npm.ywwl.com/dns-socket/download/dns-socket-4.1.2.tgz","fileCount":5,"unpackedSize":10945,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcR5FrCRA9TVsSAnZWagAAAMcP/i2LOM8TZEOg4mHylNVG\n8V5orSFy0batyk2Rmoy4m3gdZ7WwMMqvJ6WLjT/YzIQdoqhsz84oY0hOIlpS\nopC20ES0LEseEBswfYhGDzVnTbvaSx0xMpnPYs3bU4uqKxHVCgad3Bq2mDV5\nJ6PDnQwmNI/PeGwd3j0mpbvaPCkhlx20dVBDoJvqjvyPKGmjX8Jm3outQGVe\nwQ5ACJAuuTFM0PwIw8A6fy7b9RXz8p2BhHFtOhh9bLRz3W1DWL4jQr7u/MAH\ntvzLwBID4cBnP/d4051gbLpLcEbd1VvIIiWFx3YjEHmm5mbkztZhp+EW8N60\nhHftVsMmw3gin5YHsrFB7OQtLdDc3FODXJ/9+kYaVQyi9CwU5dx7/pkqUbnv\n8lurcu766mTOo70mor/GvRpNEMnE7n9CQvICk+U5BIXppgDp3mOgFwj8LS8Z\nMBHBik0iTXevBqposgmGlYdW1VqiI9Pek66U6jN/rO3BDajleAxkXFUVEEzv\nmUncplpXgmTcZm6qG4KE5VjD9Lq+IOzA3ZajL0PWxvw+OSwxHFwbqffdu5Jc\nBfg3aEHNXQyU1TBXGkCpCoTxMCOP6jBIZUImF1vBXqM3XYW49V17r0QE9wx+\nqCV/cE5qE8JA61mnpCNyfbBJtsMy5J/LYZmIVDAJkjSVfxbNF6bdnLCLQRNY\ntId9\r\n=GZL/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCU7WvpU57+0AyvyR/FZ9zO21GMe+5ITpo+CT+aoiOsFQIhAN/OdROK7MyuRpYtcG9e7XbyiGI3HXIC1vNj4QUP9m85"}],"size":4192,"noattachment":false,"key":"/dns-socket/-/dns-socket-4.1.2.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"silverwind","email":"npm@silverwind.io"}],"_npmUser":{"name":"silverwind","email":"npm@silverwind.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dns-socket_4.1.2_1548194154599_0.1913450854811496"},"_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":1548194154695,"_cnpm_publish_time":1548194154695,"dist-tags":{"latest":"4.2.2"}}