Iroh: A library to establish direct connection between peers

https://news.ycombinator.com/rss Hits: 7
Summary

less net work for networks What is iroh? Iroh gives you an API for dialing by public key. You say “connect to that phone”, iroh will find & maintain the fastest connection for you, regardless of where it is. The fastest route is a direct connection, so if necessary, iroh tries to hole-punch. Should this fail, it can fall back to an open ecosystem of public relay servers. To ensure these connections are as fast as possible, we continuously measure iroh. Built on QUIC Iroh uses Quinn to establish QUIC connections between nodes. This way you get authenticated encryption, concurrent streams with stream priorities, a datagram transport and avoid head-of-line-blocking out of the box. Compose Protocols Use pre-existing protocols built on iroh instead of writing your own: iroh-blobs for BLAKE3-based content-addressed blob transfer scaling from kilobytes to terabytes iroh-gossip for establishing publish-subscribe overlay networks that scale, requiring only resources that your average phone can handle iroh-docs for an eventually-consistent key-value store of iroh-blobs blobs iroh-willow for an (in-construction) implementation of the willow protocol Getting Started Rust Library It's easiest to use iroh from rust. Install it using cargo add iroh , then on the connecting side: const ALPN : & [ u8 ] = b"iroh-example/echo/0" ; let endpoint = Endpoint :: builder ( ) . discovery_n0 ( ) . bind ( ) . await ? ; // Open a connection to the accepting node let conn = endpoint . connect ( addr , ALPN ) . await ? ; // Open a bidirectional QUIC stream let ( mut send , mut recv ) = conn . open_bi ( ) . await ? ; // Send some data to be echoed send . write_all ( b"Hello, world!" ) . await ? ; send . finish ( ) ? ; // Receive the echo let response = recv . read_to_end ( 1000 ) . await ? ; assert_eq ! ( & response , b"Hello, world!" ) ; // As the side receiving the last application data - say goodbye conn . close ( 0u32 . into ( ) , b"bye!" ) ; // Close the endpoint and all its connections endpo...

First seen: 2025-06-25 18:19

Last seen: 2025-06-26 00:20