10 releases (6 breaking)

new 0.11.0 Nov 17, 2023
0.10.0 Nov 8, 2023
0.9.0 Oct 31, 2023
0.8.0 Oct 23, 2023
0.5.1 Jul 18, 2023

#1656 in Network programming

Download history 47/week @ 2023-08-01 9/week @ 2023-08-08 10/week @ 2023-08-15 38/week @ 2023-08-22 48/week @ 2023-08-29 72/week @ 2023-09-05 26/week @ 2023-09-12 56/week @ 2023-09-19 89/week @ 2023-09-26 115/week @ 2023-10-03 144/week @ 2023-10-10 174/week @ 2023-10-17 303/week @ 2023-10-24 208/week @ 2023-10-31 216/week @ 2023-11-07 69/week @ 2023-11-14

848 downloads per month
Used in 3 crates


22K SLoC


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 DERP server or derper. The DERP 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 DERP server.

Peers must know and do verify the PeerID of each other before they can connect. When using a DERP server to aid the connection establishment they will register with a home DERP server using their PublicKey. Other peers which can not establish a direct connection can then establish connection via this DERP 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 DERP server. For this, however the listening peer must be directly reachable by the connecting peer via one of it's addresses.


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.


This project is licensed under either of

at your option.


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.


~1.5M SLoC