{"id":13482499,"url":"https://github.com/libp2p/js-libp2p-mdns","last_synced_at":"2025-03-27T13:32:01.629Z","repository":{"id":1086357,"uuid":"39660589","full_name":"libp2p/js-libp2p-mdns","owner":"libp2p","description":"libp2p MulticastDNS Peer Discovery","archived":true,"fork":false,"pushed_at":"2023-07-21T15:52:27.000Z","size":1930,"stargazers_count":52,"open_issues_count":5,"forks_count":17,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-08-12T21:27:46.881Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://libp2p.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libp2p.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-07-24T22:16:29.000Z","updated_at":"2024-02-10T18:16:18.000Z","dependencies_parsed_at":"2024-06-18T13:49:04.071Z","dependency_job_id":"dc80e0cf-cc0f-45e1-8a68-f5678e1e3ef2","html_url":"https://github.com/libp2p/js-libp2p-mdns","commit_stats":{"total_commits":222,"total_committers":27,"mean_commits":8.222222222222221,"dds":0.6666666666666667,"last_synced_commit":"e0efcd796f4f08f9d803fd9527631763b61d2d5a"},"previous_names":["diasdavid/node-ipfs-mdns","diasdavid/js-libp2p-mdns-discovery","diasdavid/node-libp2p-mdns-discovery"],"tags_count":61,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-mdns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-mdns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-mdns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-libp2p-mdns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libp2p","download_url":"https://codeload.github.com/libp2p/js-libp2p-mdns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221845742,"owners_count":16890671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:01:02.591Z","updated_at":"2024-10-30T16:31:12.436Z","avatar_url":"https://github.com/libp2p.png","language":"TypeScript","funding_links":[],"categories":["Modules","TypeScript"],"sub_categories":[],"readme":"# 📁 Archived - this module has been merged into [js-libp2p](https://github.com/libp2p/js-libp2p/tree/master/packages/peer-discovery-mdns)\n\n# @libp2p/mdns \u003c!-- omit in toc --\u003e\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-mdns.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-mdns)\n[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-mdns/js-test-and-release.yml?branch=master\\\u0026style=flat-square)](https://github.com/libp2p/js-libp2p-mdns/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)\n\n\u003e Node.js libp2p mDNS discovery implementation for peer discovery\n\n## Table of contents \u003c!-- omit in toc --\u003e\n\n- [Install](#install)\n- [Usage](#usage)\n- [MDNS messages](#mdns-messages)\n- [API Docs](#api-docs)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i @libp2p/mdns\n```\n\n## Usage\n\n```Typescript\nimport { mdns } from '@libp2p/mdns'\n\nconst options = {\n  peerDiscovery: [\n    mdns()\n  ]\n}\n\nasync function start () {\n  const libp2p = await createLibp2p(options)\n\n  libp2p.on('peer:discovery', function (peerId) {\n    console.log('found peer: ', peerId.toB58String())\n  })\n\n  await libp2p.start()\n}\n\n```\n\n- options\n  - `peerName` - Peer name to announce (should not be peeer id), default random string\n  - `multiaddrs` - multiaddrs to announce\n  - `broadcast` - (true/false) announce our presence through mDNS, default `false`\n  - `interval` - query interval, default 10 \\* 1000 (10 seconds)\n  - `serviceTag` - name of the service announce , default 'ipfs.local\\`\n\n\n## MDNS messages\n\nA query is sent to discover the IPFS nodes on the local network\n\n```js\n{\n  type: 'query',\n  questions: [ { name: 'ipfs.local', type: 'PTR' } ]\n}\n```\n\nWhen a query is detected, each IPFS node sends an answer about itself\n\n```js\n    [ { name: 'ipfs.local',\n        type: 'PTR',\n        class: 'IN',\n        ttl: 120,\n        data: 'QmNPubsDWATVngE3d5WDSNe7eVrFLuk38qb9t6vdLnu2aK.ipfs.local' },\n      { name: 'QmNPubsDWATVngE3d5WDSNe7eVrFLuk38qb9t6vdLnu2aK.ipfs.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      { name: 'QmNPubsDWATVngE3d5WDSNe7eVrFLuk38qb9t6vdLnu2aK.ipfs.local',\n        type: 'TXT',\n        class: 'IN',\n        ttl: 120,\n        data: ['QmNPubsDWATVngE3d5WDSNe7eVrFLuk38qb9t6vdLnu2aK'] },\n      { name: 'LAPTOP-G5LJ7VN9',\n        type: 'A',\n        class: 'IN',\n        ttl: 120,\n        data: '127.0.0.1' },\n      { name: 'LAPTOP-G5LJ7VN9',\n        type: 'AAAA',\n        class: 'IN',\n        ttl: 120,\n        data: '::1' } ]\n```\n\n## API Docs\n\n- \u003chttps://libp2p.github.io/js-libp2p-mdns\u003e\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / \u003chttp://opensource.org/licenses/MIT\u003e)\n\n## Contribute\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibp2p%2Fjs-libp2p-mdns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibp2p%2Fjs-libp2p-mdns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibp2p%2Fjs-libp2p-mdns/lists"}