explaingit

n0-computer/iroh

8,533RustAudience · developerComplexity · 4/5LicenseSetup · moderate

TLDR

Iroh is a Rust library for connecting devices directly by public key instead of IP address, enabling reliable peer-to-peer connections through firewalls with automatic fallback to relay servers.

Mindmap

mindmap
  root((iroh))
    Core concept
      Connect by public key
      Not by IP address
    Connection methods
      Hole-punching
      Relay fallback
      QUIC transport
    Components
      iroh-blobs
      iroh-gossip
      iroh-docs
    Audience
      Rust developers
      P2P app builders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a peer-to-peer file transfer app that works through home routers and firewalls without requiring port forwarding.

USE CASE 2

Create a real-time sync service between devices that automatically reconnects when they change networks or get new IP addresses.

USE CASE 3

Implement a gossip messaging network where messages spread across many devices even on phones with limited resources.

USE CASE 4

Transfer large files between two devices with verified integrity using iroh-blobs.

Tech stack

RustQUIC

Getting it running

Difficulty · moderate Time to first run · 30min

Rust required, bindings for non-Rust languages are in a separate repository.

Use freely for any purpose including commercial, under either the MIT or Apache 2.0 license, your choice.

In plain English

Iroh is a Rust networking library built around one idea: instead of connecting to a device by its IP address, you connect to it by a public key. IP addresses change when devices move between networks, get reassigned by internet providers, or sit behind firewalls and routers. A public key stays with a device permanently, so iroh can always find and maintain the fastest connection regardless of where the device actually is at that moment. To make a direct connection work between two devices that are both behind home routers or corporate firewalls, iroh uses a technique called hole-punching. Without going into networking detail, this is a method of tricking two firewalls into letting traffic through between devices that neither firewall would normally allow to connect directly. If hole-punching fails, iroh falls back to an open network of public relay servers. The project measures connection performance continuously and publishes those results publicly. The transport layer is QUIC, a modern protocol originally developed by Google and now an internet standard. QUIC provides encrypted connections, lets multiple streams of data travel over one connection without one slow stream blocking the others, and supports sending small packets of data alongside the main streams. On top of the core connection library, the project offers several companion components. Iroh-blobs handles transferring files of any size, from kilobytes to terabytes, using a specific hashing format for verified transfers. Iroh-gossip sets up publish-subscribe networks where messages spread across many participants, designed to work even on phones with limited resources. Iroh-docs provides a simple key-value store that eventually becomes consistent across devices. Iroh is primarily a Rust library, but a separate repository provides bindings so it can be used from other programming languages. The project is dual-licensed under MIT and Apache 2.0.

Copy-paste prompts

Prompt 1
Using the iroh Rust library, write code to establish a direct QUIC connection between two peers identified only by their public keys.
Prompt 2
Show me how to use iroh-blobs to send a large file from one device to another with hash-verified transfer and progress reporting.
Prompt 3
How do I set up iroh-gossip so multiple devices subscribe to a shared topic and receive messages even when behind different firewalls?
Prompt 4
Write a Rust example using iroh that opens multiple independent data streams over one connection without streams blocking each other.
Open on GitHub → Explain another repo

← n0-computer on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.