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
14pub mod bind;
15mod client;
16mod connect;
17mod crypto;
18mod error;
19#[cfg(feature = "jemalloc")]
20pub mod jemalloc;
21mod log;
22#[cfg(feature = "noq")]
23pub mod noq;
24#[cfg(feature = "quinn")]
25pub mod quinn;
26mod reconnect;
27mod server;
28pub mod tls;
29mod util;
30#[cfg(feature = "watch")]
31pub mod watch;
32#[cfg(feature = "websocket")]
33pub mod websocket;
34
35pub use client::*;
36pub use connect::ConnectError;
37pub use error::{Error, Result};
38pub use log::*;
39pub use reconnect::*;
40pub use server::*;
41
42// Re-export these crates.
43pub use moq_net;
44pub use rustls;
45
46/// Re-exported because [`watch::FileWatcher`] surfaces `notify::Result`/`notify::Error`
47/// in its API; a major `notify` bump is therefore a breaking change for this crate.
48#[cfg(feature = "watch")]
49pub use notify;
50
51#[cfg(feature = "quiche")]
52pub mod quiche;
53
54#[cfg(feature = "iroh")]
55pub mod 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}