Iroh: A library to establish direct connection between peers

2025-06-2516:3425956github.com

peer-2-peer that just works. Contribute to n0-computer/iroh development by creating an account on GitHub.

You can’t perform that action at this time.


Read the original article

Comments

  • By Ingon 2025-06-2521:002 reply

    I work on connet [1] and from what I've seen iroh seem pretty cool. A few random thoughts I had while watching the presentations/reading the docs:

    * the relays serve both for discovery and relay. In connet these are separate responsibilities, e.g. it has control server for discovery and a relay server for relaying connections.

    * it seems that the connections to the relays in iroh are TCP (at least what was said in one of the videos), while connet uses QUIC in all cases. This probably makes iroh more resilient, but multiplexing on top of TCP might suffer from head of line blocking.

    * it is pretty cool that iroh can seamlessly upgrade from relay to direct connection, connet doesn't do that on a connection level. It will however use direct in the subsequent virtual connections.

    * using ALPNs for protocol selection is pretty cool, connet only offers "virtual connections" protocol, where one of the peers is "server" and the other is a "client".

    * since there is a separate discovery server (with auth), in connet the endpoints are named separately with logical names, they don't represent peers necessarily. Because of this, you can have multiple peers with "server" role and "client" roles.

    Anyhow, thanks for posting this, iroh looks great and I will draw some inspiration from it for sure.

    [1] https://github.com/connet-dev/connet

    • By rklaehn 2025-06-2610:531 reply

      There might be a small misunderstanding here. Our relays do two things. They relay user data, and relay a small number of special packets to help with hole punching. Other than that they are very simple. They never see unencrypted data, so they don't know anything more about the nodes they serve than what they need to function.

      Connections are TCP https websocket connections, because this is most likely to get through even the most restrictive firewalls.

      Discovery is handled outside the relays, via either a special DNS server or via the bittorrent mainline DHT. You can even implement your own discovery.

      • By Ingon 2025-06-2617:18

        Thanks for the correction, I'm still new to iroh and looking to learn more!

        Seems that the relays in iroh play the role of STUN and TURN (maybe even implement these)?

        I'd have to read more about DNS discovery (and dht), very interesting.

    • By nerdsniper 2025-06-262:16

      > * the relays serve both for discovery and relay. In connet these are separate responsibilities, e.g. it has control server for discovery and a relay server for relaying connections.

      What are the relative advantages/disadvantages of these two strategies?

  • By eminence32 2025-06-2520:192 reply

    Some years ago, "iroh" was supposed to a replacement for ipfs. However since then, they (very smartly, in my opinion) dropped those ambitions and are just focused on being a high-quality library for anyone writing a P2P app (like ipfs).

    I often see projects attempting to be a universe tool to solve every possible problem, and I think the iroh folks were smart to scale back and narrow their focus

    • By rkagerer 2025-06-277:11

      Aye. You often solve a technical problem while working to build something and later it turns out that building block has more utility than the thing you set out to build.

    • By dignifiedquire 2025-06-2521:21

      appreciate the feedback, it was a hard decision to make, but has felt more right everyday since we made it

  • By aquariusDue 2025-06-2518:232 reply

    I attended a workshop for iroh a while ago and really enjoyed it, and from what I can tell on the Discord server the folks developing it are gearing for a 1.0 release soon-ish.

    There's also Dumb Pipe and SendMe which are demos (I believe) built on iroh to showcase some of its uses, and at the workshop we were shown a video of a startup using iroh for video game streaming (something similar to the old OnLive).

    From what I understood (in spite of my lack of networking knowledge) and if I remember correctly clients have to be on the same relay (I think there's one for Europe and one for North America) and they use the Bittorent DHT Mainline (I had to google the iroh blog post about it because I forgot the exact name) for discovery. There was some stuff about BGP too, but it went over my head sadly.

    I hope somebody more knowledgeable chimes in because iroh is really exciting, I feel like I could throw together a p2p application and it wouldn't be a daunting task due to it.

    • By b_fiive 2025-06-2519:081 reply

      (disclosure: I work on iroh): you're selling yourself short! All of this is accurate, except for maybe the BGP stuff :)

      Dumb Pipe & Sendme me are indeed demos, we do provide a set of default, public relays to use for free. The relay code is also open source, and if you want to pay us we can run a network for you.

      We try to provide a few different options for discovery, the one we think has the most general utility is a custom DNS server, but both local mDNS and Bittorrent Mainline are also pluggable options.

      • By divineg 2025-06-2520:452 reply

        Pardon me for jumping in the discussion, but I didn't know where else to ask this. Does Iroh support streaming, instead of moving blobs? I want to write a little p2p tool to forward one port from one machine to another. Also, forwarding UDP packets doesn't require the congestion control of QUIC. Does Iroh allow disabling it for a certain "message" or stream?

        • By rklaehn 2025-06-261:301 reply

          Yes. Iroh itself provides direct QUIC connections. iroh-blobs is a protocol on top of iroh that provides content-addressed data transfer of BLAKE3 hashed data.

          What you describe sounds like https://www.dumbpipe.dev/ , a tool/demo built on top of iroh to provide a bidirectional pipe across devices, somewhat like netcat.

          Dumbpipe also has a mode where it listens on a port using TCP.

          It sounds like you want to basically build dumbpipe for UDP. You can of course use a QUIC stream, but QUIC has an extension, which we support, to send datagrams: https://docs.rs/iroh/latest/iroh/endpoint/struct.Connection....

          This basically allows you to opt out of QUIC streams, but you still do get TLS encryption.

        • By ecesena 2025-06-261:031 reply

          It looks like they have examples with unreliable channels: https://github.com/n0-computer/iroh/tree/main/iroh/examples

          You'll prob have to check the max packet size that you want to forward because quic adds a bit of overhead.

    • By outside1234 2025-06-261:481 reply

      Was the workshop recorded?

HackerNews