Rust implementation of the Hyperswarm P2P networking stack, wire-compatible with the existing Node.js network.
This project is a faithful port targeting full interoperability with the existing Hyperswarm network. Node.js peers can discover and connect to Rust peers and vice versa.
peeroxide — topic-based peer discovery + connection management (Hyperswarm)
└── peeroxide-dht — Kademlia DHT, Noise handshakes, hole-punching, relay (HyperDHT)
└── libudx — reliable UDP transport with BBR congestion control (libudx)
use peeroxide::{spawn, discovery_key, JoinOpts, SwarmConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = SwarmConfig::with_public_bootstrap();
let (_task, handle, mut conn_rx) = spawn(config).await?;
let topic = discovery_key(b"my-application");
handle.join(topic, JoinOpts::default()).await?;
while let Some(conn) = conn_rx.recv().await {
println!("connected to {}", hex::encode(conn.remote_public_key()));
}
Ok(())
}- peeroxide
High-level swarm management and topic-based discovery. - peeroxide-dht
HyperDHT implementation including Kademlia, hole-punching, and Noise handshakes. - libudx
Pure Rust implementation of the UDX protocol with BBR congestion control.
All layers are validated via golden byte fixtures and live cross-language interop tests against Node.js reference implementations. The stack uses pure Rust crypto (RustCrypto) and excludes C dependencies. It targets the Rust 2024 edition and uses the tokio async runtime.
This work implements the protocols defined in the following reference projects:
Version 1.0.0 — initial public release. The full protocol stack is implemented and validated, including live network interoperability with the Node.js reference implementation.
Dual-licensed under MIT OR Apache-2.0. See THIRD_PARTY_NOTICES for upstream license details.