TIL: Iroh: peer-to-peer networking for app developers

I came across Iroh (via, via) today as it hit 1.0 and found it a really interesting solution to a problem I knew existed but had not thought a lot about.

Judging from the comment sections, it seems pretty clear that lots of people are confused as to exactly what Iroh is. I don’t think their launch post does their product justice at all, and their tagline is “IP addresses break, dial keys instead” which sounds cool, but if you think about it for just a second, you’ll end up with lots of questions. The biggest one is: “so how is this different from a mesh VPN like Tailscale, ZeroTier, Netbird, etc.?”

It’s only after reading a lot of developers’ comments on the threads that I feel I understand: Iroh is aimed at application developers who want to communicate P2P between machines running their app, while mesh networks are aimed at network admins who want to connect devices they own/manage together.

Imagine you’re developing a peer-to-peer messaging app where, on one side, the user is on a mobile device which constantly roams between WiFi/mobile data (so doesn’t have a stable IP address), and the other side is a laptop sitting behind a NAT and a CGNAT.

If I want to get these folks to talk to each other, I need some mechanism to deal with two problems at once: the mobile’s address keeps changing as it roams, and neither side has a stable public IP the other can reach directly. Now, historically to fix these problems, the developer would need to have an intermediary server which both endpoints talk to so they can share state, create a protocol to exchange IP addresses, and do NAT hole-punching to set up the connection, falling back to acting as a real relay if none of that is possible [1].

What Iroh does instead is standardise this as a set of libraries and protocols as well as offer it as a managed service that you can just drop into your app. They also appear to be leaning heavily on standards like QUIC instead of reinventing the wheel, which is always nice to see.

Overall, this is a pretty neat idea for a difficult problem! I’m definitely curious to try it out; I don’t have a use case in mind, but I’m now on the lookout for one!

[1] If you want to learn more on this, I would strongly suggest reading this excellent Tailscale article which I learned a lot from myself.