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//! - Plain TCP via the `tcp://` scheme (qmux, no TLS; requires `tcp` feature)
8//! - Unix domain socket via the `unix://` scheme (qmux, peer-credential aware; requires `uds` feature, unix-only)
9//! - Iroh P2P (requires `iroh` feature)
10//!
11//! See [`Client`] for connecting to relays and [`Server`] for accepting connections.
12
13/// Default maximum number of concurrent QUIC streams (bidi and uni) per connection.
14pub(crate) const DEFAULT_MAX_STREAMS: u64 = 1024;
15
16pub mod bind;
17mod client;
18mod connect;
19mod crypto;
20mod error;
21#[cfg(feature = "jemalloc")]
22pub mod jemalloc;
23mod log;
24#[cfg(feature = "noq")]
25pub mod noq;
26#[cfg(feature = "quinn")]
27pub mod quinn;
28mod reconnect;
29mod server;
30#[cfg(feature = "tcp")]
31pub mod tcp;
32pub mod tls;
33#[cfg(all(feature = "uds", unix))]
34pub mod unix;
35mod util;
36#[cfg(feature = "watch")]
37pub mod watch;
38#[cfg(feature = "websocket")]
39pub mod websocket;
40
41pub use client::*;
42pub use connect::ConnectError;
43pub use error::{Error, Result};
44pub use log::*;
45pub use reconnect::*;
46pub use server::*;
47
48// Re-export these crates.
49pub use moq_net;
50pub use rustls;
51
52/// Re-exported because [`watch::FileWatcher`] surfaces `notify::Result`/`notify::Error`
53/// in its API; a major `notify` bump is therefore a breaking change for this crate.
54#[cfg(feature = "watch")]
55pub use notify;
56
57/// Re-exported because [`tls::init_android`] takes `jni` handles; a major `jni`
58/// bump is therefore a breaking change for this crate.
59#[cfg(target_os = "android")]
60pub use jni;
61
62#[cfg(feature = "quiche")]
63pub mod quiche;
64
65#[cfg(feature = "iroh")]
66pub mod iroh;
67
68/// The QUIC backend to use for connections.
69#[derive(Clone, Debug, clap::ValueEnum, serde::Serialize, serde::Deserialize)]
70#[serde(rename_all = "lowercase")]
71#[non_exhaustive]
72pub enum QuicBackend {
73 /// [web-transport-quinn](https://crates.io/crates/web-transport-quinn)
74 #[cfg(feature = "quinn")]
75 Quinn,
76
77 /// [web-transport-quiche](https://crates.io/crates/web-transport-quiche)
78 #[cfg(feature = "quiche")]
79 Quiche,
80
81 /// [web-transport-noq](https://crates.io/crates/web-transport-noq)
82 #[cfg(feature = "noq")]
83 Noq,
84}