A Tour of iroh
Let's take a tour of iroh! This tutorial will touch on 5 core concepts and a few supporting ideas that will get you familiar with what iroh does and how it works.
We're going to do this tutorial in rust, so the first thing we'll need to do is confirm you have a working rust environment. If you don't, you can install it by following the instructions at https://www.rust-lang.org/tools/install for your operating system.
Once you're up & running, let's create a new rust project by running the following command in your terminal:
cargo new iroh-tour
This will create an empty rust project in a new directory called iroh-tour
. Change into that directory and open it in your favorite code editor. You should be able to run it from the project root, run it with cargo run
and see something like this:
$ cargo run
Compiling iroh-tour v0.1.0 (/Users/b5/code/iroh-tour)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.69s
Running `/Users/b5/.cargo/build/debug/iroh-tour`
Hello, world!
Overview
Here's a high level overview of how everything fits together:
Iroh is a library for establishing the most direct QUIC connection possible between two devices. Every endpoint uses the public half of a cryptographic keypair to identify itself. Assuming at least one configured relay server is reachable, an endpoint keeps exactly one TCP connection to a “home relay” that other nodes use for connection establishment, and as a fallback transport. Iroh uses a suite of discovery services to resolve home relays & endpoint IDs. Connections between endpoints use QUIC ALPNs to distinguish between protocols, while routers automate the endpoint accept loop for protocol multiplexing.
This paragraph touches on five key points worth understanding in iroh:
We'll touch on each of these on the tour, and by the end you should have a good understanding of how they all fit together. The code we'll be writing here will build & execute, but it won't do much. We'll link to examples and other resources along the way so you can explore further.