13 releases (breaking)

0.14.0 Apr 15, 2024
0.13.0 Mar 25, 2024
0.12.0 Dec 20, 2023
0.11.0 Nov 17, 2023
0.5.1 Jul 18, 2023

#2000 in Network programming

Download history 54/week @ 2024-01-03 14/week @ 2024-01-10 51/week @ 2024-01-17 184/week @ 2024-01-24 536/week @ 2024-01-31 314/week @ 2024-02-07 336/week @ 2024-02-14 485/week @ 2024-02-21 498/week @ 2024-02-28 372/week @ 2024-03-06 313/week @ 2024-03-13 432/week @ 2024-03-20 613/week @ 2024-03-27 595/week @ 2024-04-03 859/week @ 2024-04-10 502/week @ 2024-04-17

2,727 downloads per month
Used in 11 crates (10 directly)

MIT/Apache

1MB
23K SLoC

iroh-net

This crate contains the networking support for iroh. Iroh networking is built on direct peer-to-peer QUIC connections that use relays and holepunching. The main structure for connection is the MagicEndpoint entrypoint.

Peer to peer connectivity is established with the help of a relay server. The relay server provides Session Traversal Utilities for NAT (STUN) for the peers and connection coordination using the DERP protocol (Designated Relay for Encrypted Packets protocol). If no direct connection can be established, the connection is relayed via the server.

Peers must know and do verify the PeerID of each other before they can connect. When using a relay server to aid the connection establishment they will register with a home relay server using their PublicKey. Other peers which can not establish a direct connection can then establish connection via this relay server. This will try to assist establishing a direct connection using STUN and holepunching but continue relaying if not possible.

Peers can also connect directly without using a relay server. For this, however the listening peer must be directly reachable by the connecting peer via one of it's addresses.

Examples

Examples for iroh-net are in iroh-net/examples, run them with cargo run --example $NAME. Details for each example are in the file/directory itself.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~39–91MB
~1.5M SLoC