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;
16#[cfg(feature = "jemalloc")]
17pub mod jemalloc;
18mod log;
19#[cfg(feature = "noq")]
20mod noq;
21#[cfg(feature = "quinn")]
22mod quinn;
23mod reconnect;
24mod server;
25#[cfg(any(feature = "noq", feature = "quinn"))]
26mod tls;
27mod util;
28#[cfg(feature = "websocket")]
29mod websocket;
30
31pub use client::*;
32pub use log::*;
33pub use reconnect::*;
34pub use server::*;
35#[cfg(feature = "websocket")]
36pub use websocket::*;
37
38// Re-export these crates.
39pub use moq_lite;
40pub use rustls;
41
42#[cfg(feature = "noq")]
43pub use web_transport_noq;
44#[cfg(feature = "quinn")]
45pub use web_transport_quinn;
46
47#[cfg(feature = "quiche")]
48mod quiche;
49#[cfg(feature = "quiche")]
50pub use web_transport_quiche;
51
52#[cfg(feature = "iroh")]
53mod iroh;
54#[cfg(feature = "iroh")]
55pub use iroh::*;
56
57/// The QUIC backend to use for connections.
58#[derive(Clone, Debug, clap::ValueEnum, serde::Serialize, serde::Deserialize)]
59#[serde(rename_all = "lowercase")]
60#[non_exhaustive]
61pub enum QuicBackend {
62	/// [web-transport-quinn](https://crates.io/crates/web-transport-quinn)
63	#[cfg(feature = "quinn")]
64	Quinn,
65
66	/// [web-transport-quiche](https://crates.io/crates/web-transport-quiche)
67	#[cfg(feature = "quiche")]
68	Quiche,
69
70	/// [web-transport-noq](https://crates.io/crates/web-transport-noq)
71	#[cfg(feature = "noq")]
72	Noq,
73}