{"name":"@libp2p/mdns","version":"10.0.8-178fe2671","keywords":["IPFS"],"license":"Apache-2.0 OR MIT","_id":"@libp2p/mdns@10.0.8-178fe2671","homepage":"https://github.com/libp2p/js-libp2p/tree/main/packages/peer-discovery-mdns#readme","bugs":{"url":"https://github.com/libp2p/js-libp2p/issues"},"dist":{"shasum":"221657621302087dabef60df4c74f71ec2b36192","tarball":"http://registry-npm.ywwl.com/@libp2p/mdns/download/@libp2p/mdns-10.0.8-178fe2671.tgz","fileCount":24,"integrity":"sha512-h88nU/DKSX4tYo7CcxX1xDRlcBalZzr/mwiYE6PmkYQU2cAv853l76u4G6iz0Tc3hQQ+rAOESI7cRynj5mEAUQ==","signatures":[{"sig":"MEYCIQDFui/R1vCRALqZEiRMMyrLW7oTgEyqQfRjKkKQpUh0rQIhAKoFB50HhuW23SM6n9UyU49gPd9R+NihhNI4t09IhuR7","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@libp2p%2fmdns@10.0.8-178fe2671","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":134460,"size":39309,"noattachment":false,"key":"/@libp2p/mdns/-/@libp2p/mdns-10.0.8-178fe2671.tgz"},"type":"module","types":"./dist/src/index.d.ts","exports":{".":{"types":"./dist/src/index.d.ts","import":"./dist/src/index.js"}},"gitHead":"178fe2671a7af9870bdd111de9073843a2a29b34","scripts":{"lint":"aegir lint","test":"aegir test -t node","build":"aegir build","clean":"aegir clean","dep-check":"aegir dep-check","test:node":"aegir test -t node --cov","test:electron-main":"aegir test -t electron-main"},"_npmUser":{"name":"npm-service-account-libp2p","email":"npm-service-account+libp2p@protocol.ai"},"repository":{"url":"git+https://github.com/libp2p/js-libp2p.git","type":"git"},"_npmVersion":"9.9.2","description":"Node.js libp2p mDNS discovery implementation for peer discovery","directories":{},"_nodeVersion":"20.10.0","dependencies":{"dns-packet":"^5.4.0","@libp2p/utils":"5.1.0-178fe2671","multicast-dns":"^7.2.5","@libp2p/peer-id":"4.0.2-178fe2671","@libp2p/interface":"1.0.2-178fe2671","@types/multicast-dns":"^7.2.1","@multiformats/multiaddr":"^12.1.10"},"eslintConfig":{"extends":"ipfs","parserOptions":{"project":true,"sourceType":"module"}},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"aegir":"^41.0.2","sinon-ts":"^2.0.0","p-wait-for":"^5.0.2","@libp2p/logger":"4.0.2-178fe2671","@libp2p/peer-id-factory":"4.0.1-178fe2671","@libp2p/interface-internal":"1.0.3-178fe2671","@libp2p/interface-compliance-tests":"5.0.8-178fe2671"},"_npmOperationalInternal":{"tmp":"tmp/mdns_10.0.8-178fe2671_1703068576724_0.7511279213199966","host":"s3://npm-registry-packages"},"readme":"# @libp2p/mdns\n\n[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)\n[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)\n[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p)\n[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=main\\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amain)\n\n> Node.js libp2p mDNS discovery implementation for peer discovery\n\n# About\n\n<!--\n\n!IMPORTANT!\n\nEverything in this README between \"# About\" and \"# Install\" is automatically\ngenerated and will be overwritten the next time the doc generator is run.\n\nTo make changes to this section, please update the @packageDocumentation section\nof src/index.js or src/index.ts\n\nTo experiment with formatting, please run \"npm run docs\" from the root of this\nrepo and examine the changes made.\n\n-->\n\nA peer discover mechanism that uses [mDNS](https://datatracker.ietf.org/doc/html/rfc6762) to discover peers on the local network.\n\n## Example - Use with libp2p\n\n```TypeScript\nimport { createLibp2p } from 'libp2p'\nimport { mdns } from '@libp2p/mdns'\n\nconst libp2p = await createLibp2p({\n  peerDiscovery: [\n    mdns()\n  ]\n})\n\nlibp2p.addEventListener('peer:discovery', (evt) => {\n  console.log('found peer: ', evt.detail.toString())\n})\n```\n\n## MDNS messages\n\nA query is sent to discover the libp2p nodes on the local network\n\n```JSON\n{\n   \"type\": \"query\",\n   \"questions\": [{\n     \"name\": \"_p2p._udp.local\",\n     \"type\": \"PTR\"\n   }]\n}\n```\n\nWhen a query is detected, each libp2p node sends an answer about itself\n\n```JSON\n[{\n  \"name\": \"_p2p._udp.local\",\n  \"type\": \"PTR\",\n  \"class\": \"IN\",\n  \"ttl\": 120,\n  \"data\": \"QmNPubsDWATVngE3d5WDSNe7eVrFLuk38qb9t6vdLnu2aK._p2p._udp.local\"\n}, {\n  \"name\": \"QmNPubsDWATVngE3d5WDSNe7eVrFLuk38qb9t6vdLnu2aK._p2p._udp.local\",\n  \"type\": \"SRV\",\n  \"class\": \"IN\",\n  \"ttl\": 120,\n  \"data\": {\n    \"priority\": 10,\n    \"weight\": 1,\n    \"port\": \"20002\",\n    \"target\": \"LAPTOP-G5LJ7VN9\"\n  }\n}, {\n  \"name\": \"QmNPubsDWATVngE3d5WDSNe7eVrFLuk38qb9t6vdLnu2aK._p2p._udp.local\",\n  \"type\": \"TXT\",\n  \"class\": \"IN\",\n  \"ttl\": 120,\n  \"data\": [\"QmNPubsDWATVngE3d5WDSNe7eVrFLuk38qb9t6vdLnu2aK\"]\n}, {\n  \"name\": \"LAPTOP-G5LJ7VN9\",\n  \"type\": \"A\",\n  \"class\": \"IN\",\n  \"ttl\": 120,\n  \"data\": \"127.0.0.1\"\n}, {\n  \"name\": \"LAPTOP-G5LJ7VN9\",\n  \"type\": \"AAAA\",\n  \"class\": \"IN\",\n  \"ttl\": 120,\n  \"data\": \"::1\"\n}]\n```\n\n# Install\n\n```console\n$ npm i @libp2p/mdns\n```\n\n# API Docs\n\n- <https://libp2p.github.io/js-libp2p/modules/_libp2p_mdns.html>\n\n# License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](https://github.com/libp2p/js-libp2p/blob/main/packages/peer-discovery-mdns/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](https://github.com/libp2p/js-libp2p/blob/main/packages/peer-discovery-mdns/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n# Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","publish_time":1703068576933,"maintainers":[{"name":"jacobheun","email":"jacobheun@gmail.com"},{"name":"npm-service-account-libp2p","email":"npm-service-account+libp2p@ipfs.tech"},{"name":"alanshaw","email":"alan138@gmail.com"},{"name":"vascosantos","email":"santos.vasco10@gmail.com"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"daviddias","email":"mail@daviddias.me"}],"_cnpm_publish_time":1703068576933,"dist-tags":{"latest":"12.0.36","next":"12.0.36-fab409544"}}