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
13pub mod bind;
14mod client;
15mod connect;
16mod crypto;
17mod error;
18#[cfg(feature = "jemalloc")]
19pub mod jemalloc;
20mod log;
21#[cfg(feature = "noq")]
22pub mod noq;
23pub mod quic;
24#[cfg(feature = "quinn")]
25pub mod quinn;
26mod reconnect;
27mod server;
28#[cfg(feature = "tcp")]
29pub mod tcp;
30pub mod tls;
31#[cfg(all(feature = "uds", unix))]
32pub mod unix;
33mod util;
34#[cfg(feature = "watch")]
35pub mod watch;
36#[cfg(feature = "websocket")]
37pub mod websocket;
38
39pub use client::*;
40pub use connect::ConnectError;
41pub use error::{Error, Result};
42pub use log::*;
43pub use reconnect::*;
44pub use server::*;
45
46// Re-export these crates.
47pub use moq_net;
48pub use rustls;
49
50/// Re-exported because [`watch::FileWatcher`] surfaces `notify::Result`/`notify::Error`
51/// in its API; a major `notify` bump is therefore a breaking change for this crate.
52#[cfg(feature = "watch")]
53pub use notify;
54
55/// Re-exported because [`tls::init_android`] takes a `jni::Env` handle; a major
56/// `jni` bump is therefore a breaking change for this crate.
57#[cfg(target_os = "android")]
58pub use jni;
59
60#[cfg(feature = "quiche")]
61pub mod quiche;
62
63#[cfg(feature = "iroh")]
64pub mod iroh;
65
66/// The QUIC backend to use for connections.
67#[derive(Clone, Debug, clap::ValueEnum, serde::Serialize, serde::Deserialize)]
68#[serde(rename_all = "lowercase")]
69#[non_exhaustive]
70pub enum QuicBackend {
71 /// [web-transport-quinn](https://crates.io/crates/web-transport-quinn)
72 #[cfg(feature = "quinn")]
73 Quinn,
74
75 /// [web-transport-quiche](https://crates.io/crates/web-transport-quiche)
76 #[cfg(feature = "quiche")]
77 Quiche,
78
79 /// [web-transport-noq](https://crates.io/crates/web-transport-noq)
80 #[cfg(feature = "noq")]
81 Noq,
82}