{"id":13413627,"url":"https://github.com/schollz/peerdiscovery","last_synced_at":"2025-05-14T00:06:12.546Z","repository":{"id":31912428,"uuid":"130617950","full_name":"schollz/peerdiscovery","owner":"schollz","description":"Pure-Go library for cross-platform local peer discovery using UDP multicast :woman: :repeat: :woman:","archived":false,"fork":false,"pushed_at":"2025-01-09T14:10:49.000Z","size":112,"stargazers_count":656,"open_issues_count":5,"forks_count":55,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-05-08T02:57:15.437Z","etag":null,"topics":["discovery-service","lan-broadcasting","networking","peer-to-peer","udp-broadcast"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/schollz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"schollz"}},"created_at":"2018-04-22T23:59:37.000Z","updated_at":"2025-05-06T12:45:44.000Z","dependencies_parsed_at":"2023-11-09T15:30:32.005Z","dependency_job_id":"3e3c75fa-c5a9-447b-b1f5-766297de5549","html_url":"https://github.com/schollz/peerdiscovery","commit_stats":{"total_commits":96,"total_committers":11,"mean_commits":8.727272727272727,"dds":"0.26041666666666663","last_synced_commit":"f7f90234a3d2bfeb0e8b9ff01f1050d6f1812f5c"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schollz%2Fpeerdiscovery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schollz%2Fpeerdiscovery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schollz%2Fpeerdiscovery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schollz%2Fpeerdiscovery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schollz","download_url":"https://codeload.github.com/schollz/peerdiscovery/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254043470,"owners_count":22004957,"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":["discovery-service","lan-broadcasting","networking","peer-to-peer","udp-broadcast"],"created_at":"2024-07-30T20:01:44.866Z","updated_at":"2025-05-14T00:06:12.480Z","avatar_url":"https://github.com/schollz.png","language":"Go","readme":"# peerdiscovery\n\n\u003cimg src=\"https://img.shields.io/badge/coverage-89%25-brightgreen.svg?style=flat-square\" alt=\"Code coverage\"\u003e\u0026nbsp;\u003ca href=\"https://goreportcard.com/report/github.com/schollz/peerdiscovery\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/schollz/peerdiscovery?style=flat-square\" alt=\"Go Report\"\u003e\u003c/a\u003e\u0026nbsp;\u003ca href=\"https://godoc.org/github.com/schollz/peerdiscovery\"\u003e\u003cimg src=\"http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square\" alt=\"Go Doc\"\u003e\u003c/a\u003e \n\nPure-go library for cross-platform thread-safe local peer discovery using UDP multicast. I needed to use peer discovery for [croc](https://github.com/schollz/croc) and everything I tried had problems, so I made another one.\n\n\n## Install\n\nMake sure you have Go 1.5+.\n\n```\ngo get -u github.com/schollz/peerdiscovery\n```\n\n## Usage \n\nThe following is a code to find the first peer on the local network and print it out.\n\n```golang\ndiscoveries, _ := peerdiscovery.Discover(peerdiscovery.Settings{Limit: 1})\nfor _, d := range discoveries {\n    fmt.Printf(\"discovered '%s'\\n\", d.Address)\n}\n```\n\nHere's the output when running on two computers. (*Run these gifs in sync by hitting Ctl + F5*).\n\n**Computer 1:**\n\n![computer 1](https://user-images.githubusercontent.com/6550035/39165714-ba7167d8-473a-11e8-82b5-fb7401ce2138.gif)\n\n**Computer 2:**\n\n![computer 1](https://user-images.githubusercontent.com/6550035/39165716-ba8db9ec-473a-11e8-96f7-e8c64faac676.gif)\n\nFor more examples, see the scanning examples ([ipv4](https://github.com/schollz/peerdiscovery/blob/master/examples/ipv4/main.go) and [ipv6](https://github.com/schollz/peerdiscovery/blob/master/examples/ipv6/main.go)) or [the docs](https://pkg.go.dev/github.com/schollz/peerdiscovery).\n\n\n## Testing\n\nTo test the peer discovery with just one host, one can launch multiple containers. The provided `Dockerfile` will run the example code.\nPlease make sure to enable [Docker's IPv6 support](https://docs.docker.com/v17.09/engine/userguide/networking/default_network/ipv6/) if you are using IPv6 for peer discovery.\n\n```console\n# Build the container, named peertest\n$ docker build -t peertest .\n\n# Execute the following command in multiple terminals\n$ docker run -t --rm peertest\nScanning for 10 seconds to find LAN peers\n 100% |████████████████████████████████████████|  [9s:0s]Found 1 other computers\n0) '172.17.0.2' with payload 'zqrecHipCO'\n```\n\n\n## Contributing\n\nPull requests are welcome. Feel free to...\n\n- Revise documentation\n- Add new features\n- Fix bugs\n- Suggest improvements\n\n## Thanks\n\nThanks [@geistesk](https://github.com/geistesk) for adding IPv6 support and a `Notify` func, and helping maintain! Thanks [@Kunde21](https://github.com/Kunde21) for providing a bug fix and massively refactoring the code in a much better way. Thanks [@robpre](https://github.com/robpre) for finding and fixing bugs. Thanks [@shvydky](https://github.com/shvydky) for adding dynamic payloads.\n\n## License\n\nMIT\n","funding_links":["https://github.com/sponsors/schollz"],"categories":["Misc","Go","Networking","网络相关库","网络","Relational Databases"],"sub_categories":["Strings","Uncategorized","暂未分类","Advanced Console UIs","Transliteration","音译","交流","暂未分类这些库被放在这里是因为其他类别似乎都不适合。"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschollz%2Fpeerdiscovery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschollz%2Fpeerdiscovery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschollz%2Fpeerdiscovery/lists"}