{"name":"multicast-dns","version":"7.2.3","description":"Low level multicast-dns implementation in pure javascript","main":"index.js","scripts":{"test":"standard && tape test.js"},"bin":{"multicast-dns":"cli.js"},"dependencies":{"dns-packet":"^5.2.2","thunky":"^1.0.2"},"devDependencies":{"standard":"^11.0.1","tape":"^4.8.0"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/multicast-dns.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/multicast-dns/issues"},"homepage":"https://github.com/mafintosh/multicast-dns","keywords":["multicast","dns","mdns","multicastdns","dns-sd","service","discovery","bonjour","avahi"],"coordinates":[55.6465878,12.5492251],"gitHead":"309a1aa77fc85a81f04117ca16350b87a26faba1","_id":"multicast-dns@7.2.3","_nodeVersion":"16.1.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-TzxgGSLRLB7tqAlzjgd2x2ZE0cDsGFq4rs9W4yE5xp+7hlRXeUQGtXZsTGfGw2FwWB45rfe8DtXMYBpZGMLUng==","shasum":"cbd07571dda41807b36f71067681f19e85ccc2cd","tarball":"http://registry-npm.ywwl.com/multicast-dns/download/multicast-dns-7.2.3.tgz","fileCount":9,"unpackedSize":21486,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgrBThCRA9TVsSAnZWagAA3SoP/3b9OGjdUDVgsS6FpuyM\nibf59rZmg8IvE8f5cv4Ez7My0vB97fLbJGm19lNp0fdtQeemQK9yAALHIFsf\nQjlMoGJu1UztFp+63StYbVDeg6h4I4+fyEKKRdD2KIS1mZNfxp91XigT3Ixb\n4Uo7Fozgj+v35kqt4AfrrkFkQl3j2dypj8Hi11g6TV1ROc9d6uo/EShMPcbo\nTqm8JZgTlt5YyK1VMFsxFxq1N0e4PxV0RAtngbx1pyOe56FvwUwzrO0IydkB\nNDu//0ezEDm4Ra07LlMxPlutUod2sIyxhpsSTT7Zt9DFBCMPANsaQfhs5jK9\nXIaSQV85vqqpsAiYbv3+OuXwLhEbnUx2OLCae0LZwhDNCEdEKjE5wudPi18+\n1l37paSgxLXfE/fB8PUY5iSp1gWMQ6fGCeQXAMOqNTRnQiKfjS8caySd/7nv\nLHnRQRxhscm3Cp4fP99+AYeUDJtgX45daM9m72MKkIauDv8f3KhKXAvAI9Jb\nKq4A+XX1tT0JCEqDc0aA1JfxXnUyo6DKagkQnwgl0GzrNYdNHcWuLWGHcxhX\nqsoshk5OaaaW19iJTxQETWy//eH3QRSvtZ8vD8Ce1QCm7vhWU7OsU64ayt6q\nuCAU8MkIE2mXUsw6vbthMT+fusgVtP0K8Nla7413wNR0JIbWP+uFVMPTvwIh\nEjVL\r\n=G47O\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGxm4Leo835Q5U2f8MNI99CRdelzA+mchI/COY4Q3/cWAiEA3MpPJwkt+zr0EHbC9riKAe8cK0g2xAQI1hM3uJvq4kM="}],"size":5967,"noattachment":false,"key":"/multicast-dns/-/multicast-dns-7.2.3.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"watson","email":"w@tson.dk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/multicast-dns_7.2.3_1621890273315_0.866488741552488"},"_hasShrinkwrap":false,"readme":"# multicast-dns\n\nLow level multicast-dns implementation in pure javascript\n\n```\nnpm install multicast-dns\n```\n\n[![build status](http://img.shields.io/travis/mafintosh/multicast-dns.svg?style=flat)](http://travis-ci.org/mafintosh/multicast-dns)\n\n## Usage\n\n``` js\nvar mdns = require('multicast-dns')()\n\nmdns.on('response', function(response) {\n  console.log('got a response packet:', response)\n})\n\nmdns.on('query', function(query) {\n  console.log('got a query packet:', query)\n})\n\n// lets query for an A record for 'brunhilde.local'\nmdns.query({\n  questions:[{\n    name: 'brunhilde.local',\n    type: 'A'\n  }]\n})\n```\n\nRunning the above (change `brunhilde.local` to `your-own-hostname.local`) will print an echo of the query packet first\n\n``` js\ngot a query packet: { type: 'query',\n  questions: [ { name: 'brunhilde.local', type: 'A', class: 1 } ],\n  answers: [],\n  authorities: [],\n  additionals: [] }\n```\n\nAnd then a response packet\n\n``` js\ngot a response packet: { type: 'response',\n  questions: [],\n  answers:\n   [ { name: 'brunhilde.local',\n       type: 'A',\n       class: 'IN',\n       ttl: 120,\n       flush: true,\n       data: '192.168.1.5' } ],\n  authorities: [],\n  additionals:\n   [ { name: 'brunhilde.local',\n       type: 'A',\n       class: 'IN',\n       ttl: 120,\n       flush: true,\n       data: '192.168.1.5' },\n     { name: 'brunhilde.local',\n       type: 'AAAA',\n       class: 'IN',\n       ttl: 120,\n       flush: true,\n       data: 'fe80::5ef9:38ff:fe8c:ceaa' } ] }\n```\n\n\n# CLI\n\n```\nnpm install -g multicast-dns\n```\n\n```\nmulticast-dns brunhilde.local\n> 192.168.1.1\n```\n\n# API\n\nA packet has the following format\n\n``` js\n{\n  questions: [{\n    name: 'brunhilde.local',\n    type: 'A'\n  }],\n  answers: [{\n    name: 'brunhilde.local',\n    type: 'A',\n    ttl: seconds,\n    data: (record type specific data)\n  }],\n  additionals: [\n    (same format as answers)\n  ],\n  authorities: [\n    (same format as answers)\n  ]\n}\n```\n\nCurrently data from `SRV`, `A`, `PTR`, `TXT`, `AAAA` and `HINFO` records is passed\n\n#### `mdns = multicastdns([options])`\n\nCreates a new `mdns` instance. Options can contain the following\n\n``` js\n{\n  multicast: true // use udp multicasting\n  interface: '192.168.0.2' // explicitly specify a network interface. defaults to all\n  port: 5353, // set the udp port\n  ip: '224.0.0.251', // set the udp ip\n  ttl: 255, // set the multicast ttl\n  loopback: true, // receive your own packets\n  reuseAddr: true // set the reuseAddr option when creating the socket (requires node >=0.11.13)\n}\n```\n\n#### `mdns.on('query', (packet, rinfo))`\n\nEmitted when a query packet is received.\n\n``` js\nmdns.on('query', function(query) {\n  if (query.questions[0] && query.questions[0].name === 'brunhilde.local') {\n    mdns.respond(someResponse) // see below\n  }\n})\n```\n\n#### `mdns.on('response', (packet, rinfo))`\n\nEmitted when a response packet is received.\n\nThe response might not be a response to a query you send as this\nis the result of someone multicasting a response.\n\n#### `mdns.query(packet, [cb])`\n\nSend a dns query. The callback will be called when the packet was sent.\n\nThe following shorthands are equivalent\n\n``` js\nmdns.query('brunhilde.local', 'A')\nmdns.query([{name:'brunhilde.local', type:'A'}])\nmdns.query({\n  questions: [{name:'brunhilde.local', type:'A'}]\n})\n```\n\n#### `mdns.respond(packet, [cb])`\n\nSend a dns response. The callback will be called when the packet was sent.\n\n``` js\n// reply with a SRV and a A record as an answer\nmdns.respond({\n  answers: [{\n    name: 'my-service',\n    type: 'SRV',\n    data: {\n      port: 9999,\n      weight: 0,\n      priority: 10,\n      target: 'my-service.example.com'\n    }\n  }, {\n    name: 'brunhilde.local',\n    type: 'A',\n    ttl: 300,\n    data: '192.168.1.5'\n  }]\n})\n```\n\nThe following shorthands are equivalent\n\n``` js\nmdns.respond([{name:'brunhilde.local', type:'A', data:'192.158.1.5'}])\nmdns.respond({\n  answers: [{name:'brunhilde.local', type:'A', data:'192.158.1.5'}]\n})\n```\n\n#### `mdns.destroy()`\n\nDestroy the mdns instance. Closes the udp socket.\n\n# Development\n\nTo start hacking on this module you can use this example to get started\n\n```\ngit clone git://github.com/mafintosh/multicast-dns.git\nnpm install\nnode example.js\nnode cli.js $(hostname).local\n```\n\n## License\n\nMIT\n","publish_time":1621890273427,"_cnpm_publish_time":1621890273427,"dist-tags":{"latest":"7.2.5"}}