{"name":"@libp2p/mdns","version":"9.0.6-73b87c5a","keywords":["IPFS"],"license":"Apache-2.0 OR MIT","_id":"@libp2p/mdns@9.0.6-73b87c5a","homepage":"https://github.com/libp2p/js-libp2p/tree/master/packages/peer-discovery-mdns#readme","bugs":{"url":"https://github.com/libp2p/js-libp2p/issues"},"dist":{"shasum":"b7abc8b65e68f2695d87307a2c5f7a05e015e036","tarball":"http://registry-npm.ywwl.com/@libp2p/mdns/download/@libp2p/mdns-9.0.6-73b87c5a.tgz","fileCount":19,"integrity":"sha512-MrGLGMIuwJX3fiomxmk12eLz6bIA7De5K+4/PYrwJCm2FhmWLhHLBFhoNHxv8o2PMtdsyq4PAFfXqAsQP+ewug==","signatures":[{"sig":"MEUCIQDh+akkAB7RuAA6YnC+mcFh4IFjj0yDAeyYhhh/4GT5LQIgBwFJLmQF8pxk4/OOh/EJ9kupTgA+umMtlycBQMfqvAM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":136127,"size":41877,"noattachment":false,"key":"/@libp2p/mdns/-/@libp2p/mdns-9.0.6-73b87c5a.tgz"},"type":"module","types":"./dist/src/index.d.ts","exports":{".":{"types":"./dist/src/index.d.ts","import":"./dist/src/index.js"}},"gitHead":"73b87c5a1474f9acd47989b675724ea64d02c7b9","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.8.1","description":"Node.js libp2p mDNS discovery implementation for peer discovery","directories":{},"_nodeVersion":"18.17.1","dependencies":{"dns-packet":"^5.4.0","@libp2p/utils":"4.0.2-73b87c5a","multicast-dns":"^7.2.5","@libp2p/logger":"3.0.2-73b87c5a","@libp2p/peer-id":"3.0.2-73b87c5a","@libp2p/interface":"0.1.2-73b87c5a","@types/multicast-dns":"^7.2.1","@multiformats/multiaddr":"^12.1.5"},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"aegir":"^40.0.8","ts-sinon":"^2.0.2","p-wait-for":"^5.0.2","@libp2p/peer-id-factory":"3.0.3-73b87c5a","@libp2p/interface-internal":"0.1.4-73b87c5a","@libp2p/interface-compliance-tests":"4.0.5-73b87c5a"},"_npmOperationalInternal":{"tmp":"tmp/mdns_9.0.6-73b87c5a_1694189669150_0.6994144373355466","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":1694189669368,"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":1694189669368,"dist-tags":{"latest":"12.0.36","next":"12.0.36-fab409544"}}