#iroh #protocols

iroh-ping

high level PING-PONG iroh protocol

7 releases (breaking)

new 0.7.0 Nov 5, 2025
0.6.0 Oct 21, 2025
0.5.0 Oct 9, 2025
0.4.0 Sep 19, 2025
0.1.0 Jun 26, 2025

#11 in #iroh

Download history 8/week @ 2025-07-10 1/week @ 2025-08-14 94/week @ 2025-08-21 29/week @ 2025-08-28 69/week @ 2025-09-04 15/week @ 2025-09-11 129/week @ 2025-09-18 15/week @ 2025-09-25 21/week @ 2025-10-02 175/week @ 2025-10-09 92/week @ 2025-10-16 44/week @ 2025-10-23

339 downloads per month

MIT/Apache

42KB
99 lines

iroh ping

A very simple iroh protocol for pinging a remote node. It's a high level example & easy starting point for new projects:

use anyhow::Result;
use iroh::{protocol::Router, Endpoint, Watcher};
use iroh_ping::Ping;

#[tokio::main]
async fn main() -> Result<()> {
    // create the receive side
    let recv_ep = Endpoint::builder().discovery_n0().bind().await?;
    let recv_router = Router::builder(recv_ep)
        .accept(iroh_ping::ALPN, Ping::new())
        .spawn();
    let addr = recv_router.endpoint().node_addr().initialized().await;

    // create a send side & send a ping
    let send_ep = Endpoint::builder().discovery_n0().bind().await?;
    let send_pinger = Ping::new();
    let rtt = send_pinger.ping(&send_ep, addr).await?;
    println!("ping took: {:?} to complete", rtt);
    Ok(())
}

This is not the "real" ping

Iroh has all sorts of internal ping-type messages, this is a high level demo of a protocol, and in no way necessary for iroh's normal operation.

Dependencies

~38–73MB
~1M SLoC