Skip to main content
By default, iroh endpoints use the public relays maintained by n0.computer to facilitate connections when direct peer-to-peer links aren’t possible. The public relays are great for development and testing, but production deployments should run their own.

Why use your own relay?

Running dedicated relays gives you:
  • Isolation: your traffic isn’t mixed with other developers on the shared public network
  • Performance: relays close to your users reduce latency and improve NAT traversal success
  • Capacity: the public relays are rate-limited; your own relays have no rate limits and capacity you control
  • Redundancy: distribute relays across regions or cloud providers for failover
  • Compliance: keep relayed traffic inside your own network or jurisdiction
Iroh’s relay architecture is uniquely suited to multi-relay deployments because relays are stateless. Clients automatically fail over between relays in your list, so adding capacity or surviving an outage is just a matter of running more relay processes. See Dedicated Infrastructure for the deeper architecture story.

Get a relay

You have two paths. Pick managed if you want a relay running today without ops work; pick self-host if you have infrastructure available and want full control over the deployment.

Deploy a managed relay

Sign up for Iroh Services and spin up a managed relay for your project in minutes.

Self-host a relay

Run the iroh-relay binary on a server with a public IP and DNS name. Automatic TLS via ACME is built in.

Configure your endpoint

Once you have one or more relay URLs, configure your endpoint to use them:
use iroh::Endpoint;
use iroh::relay::RelayUrl;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let relay_url1: RelayUrl = "YOUR_RELAY_URL_US".parse()?;
    let relay_url2: RelayUrl = "YOUR_RELAY_URL_EU".parse()?;

    let endpoint = Endpoint::builder()
        .relay_mode(iroh::endpoint::RelayMode::Custom(vec![relay_url1, relay_url2]))
        .bind()
        .await?;

    Ok(())
}
For production, run at least two relays in different geographic regions, for example one in North America and one in Europe. iroh clients try multiple relays automatically, so if one becomes unreachable they’ll seamlessly fall back to another. Each relay handles up to 60,000 concurrent connections. For larger deployments, run multiple relays per region or contact us to size up.

Learn more

For the full architecture story (why stateless relays make uptime management easier, how multi-cloud resilience works, and managed relay deployment steps) see Dedicated Infrastructure.