Find answers to common questions about our modular networking stack, how it works, and how to get started building with it.
Iroh is a modular networking stack in Rust that provides an API for dialing by public key instead of IP addresses. It handles the complexity of finding and maintaining the fastest connections between endpoints, regardless of their location. Iroh uses techniques like hole-punching and falls back to public relay servers when needed, all built on top of QUIC for secure, efficient communication.
Iroh solves the fundamental problem of establishing direct connections in today's complex network environments. Traditional IP-based networking struggles with NAT traversal, firewalls, and dynamic addresses. Iroh abstracts away these challenges by allowing applications to connect using public keys, automatically finding the optimal path between endpoints. This simplifies peer-to-peer communication and makes applications more resilient to network changes.
Iroh is designed for developers building peer-to-peer applications, distributed systems, and secure communication tools. It's particularly valuable for:
Iroh works through a multi-step connection establishment process:
All communication is secured using QUIC with authenticated encryption and stream multiplexing.
Hole-punching is a technique used to establish direct connections between devices behind NAT (Network Address Translation) firewalls. When two peers want to connect:
Iroh implements sophisticated hole-punching algorithms to maximize successful direct connections, providing lower latency and better performance than relay-only connections.
Iroh is built on several key protocols:
Iroh provides several ready-to-use protocols that build on its core networking capabilities:
These protocols provide high-level functionality that developers can use directly without implementing networking logic from scratch.
Getting started with iroh is straightforward:
cargo add irohThe simplest way to start is using the pre-built protocols like iroh-blobs or iroh-gossip, which provide high-level functionality for common networking tasks.
Here's a basic example of using iroh to establish a connection:
const ALPN: &[u8] = b"iroh-example/echo/0";
let endpoint = Endpoint::bind().await?;
// Open a connection to the accepting endpoint
let conn = endpoint.connect(addr, ALPN).await?;
// Open a bidirectional QUIC stream
let (mut send, mut recv) = conn.open_bi().await?;
// Send data
send.write_all(b"Hello, world!").await?;
send.finish()?;
// Receive response
let response = recv.read_to_end(1000).await?;
assert_eq!(&response, b"Hello, world!");
// Close connection
conn.close(0u32.into(), b"bye!");
endpoint.close().await;
For more detailed examples, see the iroh-examples repository.
Yes! Iroh provides FFI (Foreign Function Interface) bindings for other languages through the iroh-ffi repository. This allows developers to use iroh from languages like Python, JavaScript, Go, and others. The FFI bindings provide the same core functionality as the Rust library but with language-specific interfaces.
Check the iroh-ffi repository for language-specific documentation and examples.
Examples are available in several places:
Examples cover basic connections, using built-in protocols, and advanced networking patterns.
The iroh repository is organized as a Rust workspace with several interdependent crates:
This modular structure allows components to be used independently while maintaining interoperability.
Iroh implements multiple layers of security:
Security is a first-class consideration in all iroh components.
Contributions are welcome! Here's how you can help:
All contributions are dual-licensed under both Apache 2.0 and MIT licenses.
Help is available through several channels:
For urgent issues, join our Discord community for immediate assistance.
Iroh is dual-licensed under both the Apache License 2.0 and the MIT license. This means you can choose the license that best suits your project needs. The full license texts are available in the repository:
Yes! Both the Apache 2.0 and MIT licenses allow for commercial use. You can use iroh in proprietary, closed-source commercial applications without any restrictions. The only requirements are:
Iroh is designed for both open-source and commercial use cases.