Skip to main content

moq_native/
lib.rs

1//! Helper library for native MoQ applications.
2//!
3//! Establishes MoQ connections over:
4//! - WebTransport (HTTP/3)
5//! - Raw QUIC (with ALPN negotiation)
6//! - WebSocket (fallback via [web-transport-ws](https://crates.io/crates/web-transport-ws))
7//! - Iroh P2P (requires `iroh` feature)
8//!
9//! See [`Client`] for connecting to relays and [`Server`] for accepting connections.
10
11/// Default maximum number of concurrent QUIC streams (bidi and uni) per connection.
12pub(crate) const DEFAULT_MAX_STREAMS: u64 = 1024;
13
14mod client;
15mod crypto;
16mod error;
17#[cfg(feature = "jemalloc")]
18pub mod jemalloc;
19mod log;
20#[cfg(feature = "noq")]
21pub mod noq;
22#[cfg(feature = "quinn")]
23pub mod quinn;
24mod reconnect;
25mod server;
26pub mod tls;
27mod util;
28// Only used by the cert-reload path, which is itself gated on a QUIC backend.
29#[cfg(any(feature = "noq", feature = "quinn"))]
30mod watch;
31#[cfg(feature = "websocket")]
32pub mod websocket;
33
34pub use client::*;
35pub use error::{Error, Result};
36pub use log::*;
37pub use reconnect::*;
38pub use server::*;
39
40// Re-export these crates.
41pub use moq_net;
42pub use rustls;
43
44#[cfg(feature = "quiche")]
45pub mod quiche;
46
47#[cfg(feature = "iroh")]
48pub mod iroh;
49
50/// The QUIC backend to use for connections.
51#[derive(Clone, Debug, clap::ValueEnum, serde::Serialize, serde::Deserialize)]
52#[serde(rename_all = "lowercase")]
53#[non_exhaustive]
54pub enum QuicBackend {
55	/// [web-transport-quinn](https://crates.io/crates/web-transport-quinn)
56	#[cfg(feature = "quinn")]
57	Quinn,
58
59	/// [web-transport-quiche](https://crates.io/crates/web-transport-quiche)
60	#[cfg(feature = "quiche")]
61	Quiche,
62
63	/// [web-transport-noq](https://crates.io/crates/web-transport-noq)
64	#[cfg(feature = "noq")]
65	Noq,
66}