xoq - X-Embodiment over QUIC
A library for building P2P and relay-based communication using either MoQ (Media over QUIC) or iroh for direct peer-to-peer connections.
Examples
MoQ (via relay)
use xoq::moq::MoqBuilder;
# async fn example() -> anyhow::Result<()> {
// Simple anonymous connection
let mut conn = MoqBuilder::new()
.path("anon/my-channel")
.connect_duplex()
.await?;
// With authentication
let mut conn = MoqBuilder::new()
.path("secure/my-channel")
.token("your-jwt-token")
.connect_duplex()
.await?;
# Ok(())
# }
Iroh (P2P)
use xoq::iroh::{IrohServerBuilder, IrohClientBuilder};
# async fn example() -> anyhow::Result<()> {
// Server with persistent identity
let server = IrohServerBuilder::new()
.identity_path(".my_server_key")
.bind()
.await?;
println!("Server ID: {}", server.id());
// Client connecting to server
let conn = IrohClientBuilder::new()
.connect_str("server-endpoint-id-here")
.await?;
# Ok(())
# }