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