Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/release-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ jobs:
- "rs/moq-congestion/**"
- "rs/moq-crypto/**"
- "rs/moq-hls/**"
- "rs/moq-ice/**"
- "rs/moq-json/**"
- "rs/moq-loc/**"
- "rs/moq-msf/**"
Expand All @@ -261,14 +260,14 @@ jobs:
- "rs/moq-pattern/**"
- "rs/moq-quic/**"
- "rs/moq-relay/**"
- "rs/moq-rtc/**"
- "rs/moq-rtmp/**"
- "rs/moq-rtsp/**"
- "rs/moq-shaper/**"
- "rs/moq-sock/**"
- "rs/moq-srt/**"
- "rs/moq-stats/**"
- "rs/moq-tokio/**"
- "rs/moq-webrtc/**"
- "rs/qmux/**"
- "Cargo.toml"
- "Cargo.lock"
Expand Down
7 changes: 4 additions & 3 deletions .oss-scanner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ RUN rustup show active-toolchain || rustup toolchain install \
&& curl -LsSf "https://get.nexte.st/$NEXTEST_VERSION/$nextest" | tar zxf - -C "$CARGO_HOME/bin" \
&& cargo nextest --version

ARG CRATES="kio hang moq-auth moq-crypto moq-hls moq-ice moq-json moq-loc moq-msf moq-mux moq-net moq-pattern moq-quic moq-relay moq-rtc moq-rtmp moq-rtsp moq-sock moq-srt moq-stats moq-tokio moq-uring moq-cli"
ARG CRATES="kio hang moq-auth moq-crypto moq-hls moq-json moq-loc moq-msf moq-mux moq-net moq-pattern moq-quic moq-relay moq-rtmp moq-rtsp moq-sock moq-srt moq-stats moq-tokio moq-uring moq-webrtc moq-cli"

# Path specs, because the lockfile also has published copies of some workspace crates.
# io-uring compiles the relay's io_uring QUIC workers (`--runtime-io-uring`), which the default features leave out.
# p2p compiles moq-webrtc's data channel transport and its tests.
RUN cargo fetch --locked \
&& specs=$(printf -- '-p path+file:///src/rs/%s ' $CRATES) \
&& cargo build --locked $specs --features moq-relay/io-uring --bins \
&& cargo test --locked --no-run $specs --features moq-relay/io-uring
&& cargo build --locked $specs --features moq-relay/io-uring,moq-webrtc/p2p --bins \
&& cargo test --locked --no-run $specs --features moq-relay/io-uring,moq-webrtc/p2p

ENV CARGO_NET_OFFLINE=true
6 changes: 3 additions & 3 deletions .oss-scanner/threat_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Treat everything a peer sends as hostile, before and after authentication:
- **WebSocket and HTTP** on the relay's `[web]` listeners: the upgrade, the public `/announced`, `/fetch` and `/certificate.sha256` endpoints, and query strings.
- **Authorization inputs**: the JWT (`moq-auth`), the SETUP token, the dialed path and query, and the relay's handling of grants (root, publish and subscribe pattern unions, mounts, expiry, revalidation).
- **Media payloads**: catalogs (`hang`, `moq-msf`, JSON in `moq-json`) and containers and codecs parsed by `moq-mux` (fMP4, MPEG-TS, FLV, MKV, LOC, and the H.264, H.265, AV1, VP8, VP9, AAC, Opus and FLAC bitstream parsers). A publisher controls these bytes, and the relay or a subscriber may parse them.
- **Ingest gateways**: RTMP (`moq-rtmp`), RTSP (`moq-rtsp`), SRT (`moq-srt`), WebRTC and ICE/STUN (`moq-rtc`, `moq-ice`), and HLS playlists and segments (`moq-hls`).
- **Ingest gateways**: RTMP (`moq-rtmp`), RTSP (`moq-rtsp`), SRT (`moq-srt`), WebRTC, ICE/STUN, and data channels (`moq-webrtc`), and HLS playlists and segments (`moq-hls`).
- **Peer relays** in a cluster are authenticated but should not be able to break a node beyond what their grant allows.

## Security properties the relay must hold
Expand All @@ -34,7 +34,7 @@ Most important, in this order:
1. `rs/moq-relay` and the crates it serves the network with: `rs/moq-net`, `rs/moq-quic`, `rs/moq-tokio`, `rs/moq-uring`, `rs/moq-sock`, `rs/moq-auth`, `rs/moq-pattern`.
2. Authorization: a session publishing, subscribing, or seeing announcements outside its grant, or reaching another root (tenant) through path tricks, revalidation, mounts, or cluster links.
3. `rs/moq-mux` and `rs/hang`: container, codec, and catalog parsing of publisher-controlled bytes.
4. The ingest gateways: `rs/moq-rtmp`, `rs/moq-rtsp`, `rs/moq-srt`, `rs/moq-rtc`, `rs/moq-ice`, `rs/moq-hls`.
4. The ingest gateways: `rs/moq-rtmp`, `rs/moq-rtsp`, `rs/moq-srt`, `rs/moq-webrtc`, `rs/moq-hls`.
5. `rs/moq-crypto`, `rs/moq-cli`, `rs/moq-json`, `rs/moq-stats`, `rs/kio`.

`unsafe` is rare and worth reading closely where it appears: `rs/moq-quic`, `rs/moq-net/src/model`, `rs/moq-net/src/util/cell.rs`, `rs/moq-net/src/transport.rs`, and `rs/moq-relay/src/uring.rs`.
Expand All @@ -45,7 +45,7 @@ Out of scope: `js/` and the other language bindings (`py/`, `swift/`, `kt/`, `go

The image is offline, with every crate fetched and `CARGO_NET_OFFLINE` set. The debug build of the in-scope crates, their test binaries, and the `moq-relay` and `moq` binaries are already built in `/src/target/debug`. Debug builds keep overflow checks on.

- **Tests**: `cargo nextest run -p path+file:///src/rs/moq-net` (or any in-scope crate; the path spec is needed because the lockfile also has published copies of some crates). Use nextest as CI does: some tests install process-global state and fail under plain `cargo test`. Add `--features moq-relay/io-uring` for the relay and `moq-uring` so the io\_uring backend's tests run (they skip on a kernel without io\_uring support). Unit tests use the deterministic clock in `kio::clock` rather than wall time, so they are fast and reproducible.
- **Tests**: `cargo nextest run -p path+file:///src/rs/moq-net` (or any in-scope crate; the path spec is needed because the lockfile also has published copies of some crates). Use nextest as CI does: some tests install process-global state and fail under plain `cargo test`. Add `--features moq-relay/io-uring` for the relay and `moq-uring` so the io\_uring backend's tests run (they skip on a kernel without io\_uring support), and `--features moq-webrtc/p2p` for the data channel transport's. Unit tests use the deterministic clock in `kio::clock` rather than wall time, so they are fast and reproducible.
- **A relay to attack**: `./target/debug/moq-relay demo/relay/localhost.toml` listens on UDP and TCP `[::]:4443` with a self-signed certificate and anonymous access to every path. The binary is built with io\_uring support; pass `--runtime-io-uring` to serve QUIC from the io\_uring workers in `rs/moq-uring` and `rs/moq-relay/src/uring.rs` instead of tokio. For authorization testing, grant a narrow anonymous pattern with `[auth] public_subscribe` / `public_publish`, or run the reference auth server (`moq auth generate`, `moq auth sign`, `moq auth serve`, then `[auth] url`; see `doc/bin/cli.md`) and try to escape a signed token's root and patterns. `doc/bin/relay/` documents the config, auth, cluster, and HTTP endpoints.
- **A client**: `./target/debug/moq --help` publishes, subscribes, fetches, and lists announcements against a relay. `curl http://localhost:4443/announced/` and `curl http://localhost:4443/fetch/<broadcast>/<track>` hit the HTTP endpoints.
- **Fuzz harnesses**: `rs/moq-net/fuzz` and `rs/moq-quic/fuzz` hold cargo-fuzz targets for the wire codecs and the QUIC state machine. cargo-fuzz and a nightly toolchain are not in the image, but the targets show the parser entry points.
Expand Down
71 changes: 29 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ default-members = [
# "rs/moq-ffi", # requires Python/maturin
# "rs/moq-gst", # requires GStreamer
"rs/moq-hls",
"rs/moq-ice",
"rs/moq-json",
"rs/moq-loc",
"rs/moq-msf",
Expand All @@ -32,7 +31,6 @@ default-members = [
"rs/moq-quic",
"rs/moq-relay",
"rs/moq-room",
"rs/moq-rtc",
"rs/moq-rtmp",
"rs/moq-rtsp",
"rs/moq-shaper",
Expand All @@ -44,6 +42,7 @@ default-members = [
"rs/moq-uring",
"rs/moq-v4l",
"rs/moq-video",
"rs/moq-webrtc",
"rs/qmux",
"rs/test-env",
# Maturin runs the workspace's `uniffi-bindgen` binary from the root to
Expand Down Expand Up @@ -111,7 +110,7 @@ humantime = "2.3"
humantime-serde = "1.1.1"
hyper = "1.11"
hyper-util = { version = "0.1.21", features = ["tokio"] }
# Interface addresses for WebRTC host candidates (moq-tokio's `webrtc` feature).
# Interface addresses for WebRTC host candidates (moq-webrtc's `p2p` feature).
if-addrs = "0.15"
indexmap = "2.14.2"
io-uring = "0.7.15"
Expand All @@ -121,7 +120,8 @@ kio-macros = { version = "0.1.0", path = "rs/kio/macros" }
libc = "0.2"
libloading = "0.9"
linux-raw-sys = { version = "0.12.1", features = ["ioctl"] }
# DNS-SD advertisement and browsing for LAN peer discovery (moq-tokio's `mdns` feature).
# DNS-SD advertisement and browsing for LAN peer discovery (moq-tokio's `mdns` feature),
# and `.local` candidate resolution (moq-webrtc's `p2p` feature).
# `async` awaits the event channel instead of blocking a thread on it.
mdns-sd = { version = "0.21", features = ["async"] }
moq-archive = { version = "0.0.11", path = "rs/moq-archive" }
Expand All @@ -131,7 +131,6 @@ moq-congestion = { version = "0.1.0", path = "rs/moq-congestion" }
# default-features off: moq-auth takes only the endpoint key and its text codec.
moq-crypto = { version = "0.0.11", path = "rs/moq-crypto", default-features = false }
moq-hls = { version = "0.5.11", path = "rs/moq-hls", default-features = false }
moq-ice = { version = "0.1.0", path = "rs/moq-ice" }
moq-json = { version = "0.5.8", path = "rs/moq-json" }
moq-loc = { version = "0.2.19", path = "rs/moq-loc" }
moq-msf = { version = "0.5.1", path = "rs/moq-msf" }
Expand All @@ -145,7 +144,6 @@ moq-pattern = { version = "0.1.2", path = "rs/moq-pattern" }
# default-features off so each consumer picks its crypto provider.
moq-quic = { version = "0.1.0", path = "rs/moq-quic", default-features = false }
moq-relay = { version = "0.17.2", path = "rs/moq-relay", default-features = false }
moq-rtc = { version = "0.3.12", path = "rs/moq-rtc" }
moq-rtmp = { version = "0.3.11", path = "rs/moq-rtmp" }
moq-rtsp = { version = "0.1.0", path = "rs/moq-rtsp" }
moq-sock = { version = "0.2.0", path = "rs/moq-sock" }
Expand Down Expand Up @@ -176,6 +174,7 @@ moq-vaapi = "0.1.1"
# that argument, so moq-ffi and moq-c opt NVIDIA and VAAPI back in (OpenH264
# through their own `openh264` feature, which release builds enable).
moq-video = { version = "0.1.10", path = "rs/moq-video", default-features = false }
moq-webrtc = { version = "0.3.12", path = "rs/moq-webrtc" }
mp4-atom = "0.17.1"
nix = { version = "0.31.3", features = ["net", "socket", "uio"] }
num_enum = "0.7"
Expand Down
2 changes: 1 addition & 1 deletion doc/bin/rtc.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ player or `export rtc --connect` must reconnect to reach the replacement.
`--connect` runs until its session ends.

Built on [str0m](https://crates.io/crates/str0m); the library is
[`moq-rtc`](https://docs.rs/moq-rtc).
[`moq-webrtc`](https://github.com/moq-dev/moq/tree/main/rs/moq-webrtc).
2 changes: 1 addition & 1 deletion doc/concept/transport.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ records, with no datagrams. The application supplies signaling and ICE and
keeps ownership of the peer connection; closing the transport closes only its
channel. SCTP ordering means one lost packet can hold back every stream.

Native peers can opt into `moq-tokio`'s internal `webrtc` feature, which runs its own ICE agent:
Native peers can use `moq-webrtc`'s `p2p` feature, which runs its own ICE agent:
host candidates on every interface, server-reflexive candidates from the STUN
servers it is given, and mDNS resolution of a browser's `.local` candidates.
The application still carries the offer, answer, and candidates; the offering
Expand Down
5 changes: 2 additions & 3 deletions doc/lib/rs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ missing required CPU feature before starting transport cryptography.
| --- | --- |
| [moq-net](/lib/rs/moq-net) | The pub/sub layer: sessions, origins, broadcasts, tracks, groups, frames. Transport-agnostic. |
| [moq-pattern](https://docs.rs/moq-pattern) | Path patterns such as `room/**`. Re-exported by moq-net and moq-auth. |
| [moq-tokio](https://docs.rs/moq-tokio) | Connects and listens over QUIC, WebTransport, WebSocket, TCP, or Unix sockets, from config or CLI flags, and runs WebRTC data channels that the caller signals (`webrtc` feature). With default features off, `driver` builds a Tokio QUIC stack, with rind cryptography, without MoQ. |
| [moq-tokio](https://docs.rs/moq-tokio) | Connects and listens over QUIC, WebTransport, WebSocket, TCP, or Unix sockets, from config or CLI flags, and runs MoQ over a qmux session established elsewhere (`qmux` feature). With default features off, `driver` builds a Tokio QUIC stack, with rind cryptography, without MoQ. |
| [qmux](https://docs.rs/qmux) | QUIC streams, datagrams, and flow control over TCP, TLS, WebSocket, and Unix sockets, on moq-quic's state machine. |
| [moq-sock](https://docs.rs/moq-sock) | Socket binding and CPU pinning for thread-per-core listeners. |
| [moq-ice](https://github.com/moq-dev/moq/tree/main/rs/moq-ice) | Internal infrastructure with no stability promise; the ICE agent behind native WebRTC: drives a str0m connection over UDP, with a STUN client. |
| [moq-uring](https://docs.rs/moq-uring) | Experimental Linux io\_uring server for moq-lite. |
| [hang](/lib/rs/hang) | The media layer: catalog, containers, ordered frame delivery. |
| [moq-mux](/lib/rs/moq-mux) | Import and export fMP4/CMAF, MPEG-TS, Matroska, FLV, and Annex-B. |
Expand All @@ -44,7 +43,7 @@ missing required CPU feature before starting transport cryptography.
| [moq-loc](https://docs.rs/moq-loc), [moq-msf](https://docs.rs/moq-msf) | The IETF LOC container and MSF catalog. |
| [moq-stats](https://docs.rs/moq-stats) | Publish and consume relay traffic counters as tracks. |
| [kio](/lib/rs/kio) | The async primitives everything polls through, and one clock for time and timers on tokio and a deterministic test simulator. |
| [moq-hls](https://docs.rs/moq-hls), [moq-rtmp](https://docs.rs/moq-rtmp), [moq-srt](https://docs.rs/moq-srt), [moq-rtsp](https://github.com/moq-dev/moq/tree/main/rs/moq-rtsp), [moq-rtc](https://docs.rs/moq-rtc) | The [gateways](/bin/), as libraries you can embed with your own auth. |
| [moq-hls](https://docs.rs/moq-hls), [moq-rtmp](https://docs.rs/moq-rtmp), [moq-srt](https://docs.rs/moq-srt), [moq-rtsp](https://github.com/moq-dev/moq/tree/main/rs/moq-rtsp), [moq-webrtc](https://github.com/moq-dev/moq/tree/main/rs/moq-webrtc) | The [gateways](/bin/), as libraries you can embed with your own auth. moq-webrtc's `p2p` feature also runs MoQ over a data channel with a browser peer, signaled by the caller. |
| [moq-ffi](https://docs.rs/moq-ffi), [moq-c](/lib/c/) | The UniFFI core behind the language bindings, and the C ABI. |
| [moq-relay](/bin/relay/), [moq-cli](/bin/cli) | The binaries, also usable as crates. |
| [web-transport](https://github.com/moq-dev/web-transport) | The WebTransport traits and the browser transport, in a sibling repository. |
Expand Down
Loading
Loading