All Projects β†’ schollz β†’ Peerdiscovery

schollz / Peerdiscovery

Licence: mit
Pure-Go library for cross-platform local peer discovery using UDP multicast πŸ‘© πŸ” πŸ‘©

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Peerdiscovery

Rust Libp2p
The Rust Implementation of the libp2p networking stack.
Stars: ✭ 2,062 (+333.19%)
Mutual labels:  networking, peer-to-peer
Gamenetworkingsockets
Reliable & unreliable messages over UDP. Robust message fragmentation & reassembly. P2P networking / NAT traversal. Encryption.
Stars: ✭ 5,795 (+1117.44%)
Mutual labels:  networking, peer-to-peer
Libzt
ZeroTier Sockets - Put a network stack in your app
Stars: ✭ 486 (+2.1%)
Mutual labels:  networking, peer-to-peer
P2p
Practice project to demonstrate p2p file sharing.
Stars: ✭ 16 (-96.64%)
Mutual labels:  networking, peer-to-peer
Gossip Python
Implementation of the gossip protocol
Stars: ✭ 100 (-78.99%)
Mutual labels:  networking, peer-to-peer
Quantumgate
QuantumGate is a peer-to-peer (P2P) communications protocol, library and API written in C++.
Stars: ✭ 62 (-86.97%)
Mutual labels:  networking, peer-to-peer
Zerotierone
A Smart Ethernet Switch for Earth
Stars: ✭ 7,839 (+1546.85%)
Mutual labels:  networking, peer-to-peer
Ice
A Go implementation of ICE
Stars: ✭ 114 (-76.05%)
Mutual labels:  networking, peer-to-peer
Stun
A Go implementation of STUN
Stars: ✭ 141 (-70.38%)
Mutual labels:  networking, peer-to-peer
Beam.cafe
🌠 Blazing fast file transfer app focused on user-experience. Fastest way to share files without uploading them.
Stars: ✭ 419 (-11.97%)
Mutual labels:  peer-to-peer
Wirehub
🌍 Decentralized, peer-to-peer and secure overlay networks
Stars: ✭ 459 (-3.57%)
Mutual labels:  peer-to-peer
Onie
Open Network Install Environment
Stars: ✭ 411 (-13.66%)
Mutual labels:  networking
Actix Net
A collection of lower-level libraries for composable network services.
Stars: ✭ 415 (-12.82%)
Mutual labels:  networking
Tenus
Linux networking in Go
Stars: ✭ 458 (-3.78%)
Mutual labels:  networking
Gnet
πŸš€ gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go./ gnet ζ˜―δΈ€δΈͺι«˜ζ€§θƒ½γ€θ½»ι‡ηΊ§γ€ιžι˜»ε‘žηš„δΊ‹δ»Άι©±εŠ¨ Go η½‘η»œζ‘†ζžΆγ€‚
Stars: ✭ 5,736 (+1105.04%)
Mutual labels:  networking
Zget
Filename based peer to peer file transfer
Stars: ✭ 465 (-2.31%)
Mutual labels:  peer-to-peer
Kube Iptables Tailer
A service for better network visibility for your Kubernetes clusters.
Stars: ✭ 413 (-13.24%)
Mutual labels:  networking
Hp Socket
High Performance TCP/UDP/HTTP Communication Component
Stars: ✭ 4,420 (+828.57%)
Mutual labels:  networking
Ucx
Unified Communication X (mailing list - https://elist.ornl.gov/mailman/listinfo/ucx-group)
Stars: ✭ 471 (-1.05%)
Mutual labels:  networking
Enet Csharp
Reliable UDP networking library
Stars: ✭ 464 (-2.52%)
Mutual labels:  networking

peerdiscovery

Code coverage Go Report Go Doc

Pure-go library for cross-platform thread-safe local peer discovery using UDP multicast. I needed to use peer discovery for croc and everything I tried had problems, so I made another one.

Install

Make sure you have Go 1.5+.

go get -u github.com/schollz/peerdiscovery

Usage

The following is a code to find the first peer on the local network and print it out.

discoveries, _ := peerdiscovery.Discover(peerdiscovery.Settings{Limit: 1})
for _, d := range discoveries {
    fmt.Printf("discovered '%s'\n", d.Address)
}

Here's the output when running on two computers. (Run these gifs in sync by hitting Ctl + F5).

Computer 1:

computer 1

Computer 2:

computer 1

For more examples, see the scanning examples (ipv4 and ipv6) or the docs.

Testing

To test the peer discovery with just one host, one can launch multiple containers. The provided Dockerfile will run the example code. Please make sure to enable Docker's IPv6 support if you are using IPv6 for peer discovery.

# Build the container, named peertest
$ docker build -t peertest .

# Execute the following command in multiple terminals
$ docker run -t --rm peertest
Scanning for 10 seconds to find LAN peers
 100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ|  [9s:0s]Found 1 other computers
0) '172.17.0.2' with payload 'zqrecHipCO'

Contributing

Pull requests are welcome. Feel free to...

  • Revise documentation
  • Add new features
  • Fix bugs
  • Suggest improvements

Thanks

Thanks @geistesk for adding IPv6 support and a Notify func, and helping maintain! Thanks @Kunde21 for providing a bug fix and massively refactoring the code in a much better way. Thanks @robpre for finding and fixing bugs. Thanks @shvydky for adding dynamic payloads.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].