diff --git a/README.md b/README.md index 71feb8f..4b1a1a4 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ bytes, events and deadlines out. | Part | What | Day | | :-- | :-- | :-- | | GameStream client | pairing handshake, app list, RTSP, the ENet-compatible control channel, input and gamepad messages, RTP video depacketizer with FEC recovery, Opus audio with FEC, stream encryption | 1 | +| GameStream host (Lumen) | the host's half of the same protocols: HTTP requests and XML answers, the pairing machine and Tessera-trusted clients, the RTSP session with DESCRIBE and a strict ANNOUNCE parser, the accepting ENet peer, the control host, video packetizer with FEC parity, Opus audio packetizer | Lumen L1 | | Harness maths | clock sync and the added-latency statistics | 2 | | Lumen | the protocol, FEC, pacing and congestion maths of Arena Domi's own engine | 3–7 | @@ -18,13 +19,16 @@ Rubylight or moonlight-common-c was opened, pasted or ported. See [`docs/CLEAN_R cargo test --workspace ``` -## Status: `stream-v0.1.0` +## Status: `stream-v0.2.0` -Written from the Wolf protocol docs and the approved permissive sources (stock ENet, tokio-enet, fec-rs). **Interop is -unverified**: this release has not yet talked to a real Sunshine host. Ten details that block interop (U1, U2, U4–U10, -U17 in [`docs/PROTOCOL.md`](docs/PROTOCOL.md)) are settled live on Arena Domi's Play remotely Day 1, and a -`stream-v0.1.x` patch is expected. Evidence for this release: 242 tests, a mutation pass (24 of 24 caught, -[`docs/MUTATION.md`](docs/MUTATION.md)), and 25 fuzz targets with 0 crashes ([`docs/HANDOVER.md`](docs/HANDOVER.md)). +| Side | State | +| :-- | :-- | +| Client (since `stream-v0.1.0`) | complete for Day 1. **Interop with a real Sunshine host is unverified**: ten details that block it (U1, U2, U4–U10, U17 in [`docs/PROTOCOL.md`](docs/PROTOCOL.md)) are settled live on Play remotely Day 1 | +| Host, for Lumen (new in `stream-v0.2.0`) | complete for Lumen L1 and tested against our own client in one in-memory session. **Interop with real clients (Arena Domi Remote, the Moonlight PC app) is unverified**: it is measured black-box at the end of L1 | + +Written from the Wolf protocol docs, Moonshine (BSD-2, facts only) and the approved permissive sources (stock ENet, +tokio-enet, fec-rs). Evidence for this release is in [`docs/HANDOVER.md`](docs/HANDOVER.md): the test suite, the +mutation pass ([`docs/MUTATION.md`](docs/MUTATION.md)) and 32 fuzz targets with 0 crashes. | Path | What | | :-- | :-- | diff --git a/docs/HANDOVER.md b/docs/HANDOVER.md index 1f1a662..720eb27 100644 --- a/docs/HANDOVER.md +++ b/docs/HANDOVER.md @@ -1,5 +1,50 @@ # DomiStream — handover +## stream-v0.2.0 (2026-12-04) + +The GameStream host side, sans-I/O, for Lumen (milestone L1, `docs/LUMEN-HOST-PLAN.md` 3.1), next to the client of +v0.1.0. The host notes per protocol are listed at the top of `docs/PROTOCOL.md` ("Host side (Lumen)"). + +| Part | Module | +| :-- | :-- | +| request head and query parsing into typed routes, XML answers (serverinfo, applist, launch/resume, pair, errors) | `host::http` | +| the host's pairing machine (pending-PIN slot, proof and signature checks), Tessera-trusted clients without a PIN | `host::pairing` | +| RTSP session (order, `Session`, statuses), DESCRIBE writer, strict ANNOUNCE parser | `rtsp::server` | +| accepting ENet peer, as stock ENet 1.3 accepts | `enet::host` | +| control host: client frames (replay refusal), rumble, termination, stop deadline | `control::host` | +| video packetizer (FEC blocks with Cauchy parity, AES-GCM sealing), Opus audio packetizer (AES-CBC, no parity: U16) | `video::packetizer`, `audio::packetizer` | + +Fixed on the client side (tests first, separate commits): +- **ENet session ids.** `EnetClient` took VERIFY_CONNECT's session ids the wrong way round (stock ENet: the client's + incoming id is the verify's incoming id). Hidden against a fresh slot (0/0); after a reconnect a stock host answers + with two different ids and the client would have dropped every host datagram. Found by the ENet host engineer. +- **Applist cap.** `MAX_APPS` was 4096, but 4096 apps of four elements need 16,385 XML elements (cap 16,384), so the + app cap could never be reached. Now 4095 = (`MAX_XML_ELEMENTS` − 1) / 4 on both sides. + +Evidence (worktree checks, 2026-12-04, every cargo run gated on CPU and RAM below 90 % and drives below 95 %): +- `cargo test --workspace`: **TESTS passed, 0 failed**, among them `tests/session.rs`: a whole session between our + client and our host in memory (pairing with the owner typing the code, HTTPS, launch, RTSP, ENet + START_B, sealed + video with FEC repairing exactly the parity budget per block and a burst beyond it reported lost and answered with + invalidation and an IDR request, sealed audio, input, gamepad, rumble, termination), plus the Tessera-trusted path + and an unpaired client refused over HTTPS. +- Mutation pass on the host modules: **MUTATION** (M25–M51, `docs/MUTATION.md`); the client rows M1–M24 are those + of v0.1.0. +- Fuzz, host targets (module engineers; Windows MSVC, SanitizerCoverage, libFuzzer), **0 crashes**: host_http_request + 8,784,228 runs in 75 s; host_pairing 45,096 in 75 s; rtsp_server 895,897 in 121 s; announce 11,659,642 in 121 s; + enet_host 2,534,001 in 60 s, then 26,839,291 in 600 s; control_host 611,513 in 60 s; video_packetizer_roundtrip + 113,740 in 76 s. 32 targets in all; the 25 client targets' runs are those of v0.1.0. +- clippy `-D warnings`, fmt and rustdoc `-D warnings` are clean. + +Open: +- **Interop with real clients unverified.** Arena Domi Remote (Android emulator) and the Moonlight PC app against + lumen-host's listeners, black-box (D2), at the end of L1. +- **START_B, PERIODIC_PING, IDR request from our own client.** `ControlStream` refuses them (bodies U10), so with it + alone our client cannot start a stream on our host, and a host with the default 60 s stop deadline would end the + session. The session test sends them with empty bodies over `EnetClient` + `ControlCipher`, as gs-probe does. + Decision for the lead: let `ControlStream` send empty bodies (what Moonshine and Lumen read) or wait for U10. +- The plan's long fuzz run (7.1) was made for enet_host (600 s) but not for host_pairing (75 s). +- Audio parity (U16), `HDR_MODE` and the plain `TERMINATION` are refused on the host until measured. + ## stream-v0.1.0 (2026-11-26) The GameStream client, sans-I/O, for Arena Domi TV (Play remotely Day 1). diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md index 1cacee6..a738f5e 100644 --- a/docs/PROTOCOL.md +++ b/docs/PROTOCOL.md @@ -1,10 +1,35 @@ -# GameStream protocol, as DomiStream speaks it (client side) +# GameStream protocol, as DomiStream speaks it (client and host side) The protocol between a GameStream host (Sunshine, later Lumen) and a client (Arena Domi TV). Written from the Wolf protocol docs in our own words, completed with facts read in Moonshine (BSD-2). Every fact has a tag; every gap is marked **UNKNOWN Un** with what would settle it. Status: 2026-11-25, implemented as stream-v0.1.0 per these docs and the approved sources; interop with a real host is unverified (the lab capture was not run, [LAB_CAPTURE.md](LAB_CAPTURE.md)). U9 narrowed and U14 settled from the approved sources (sections 3.1, 5.3); where an UNKNOWN remains, the code follows the Wolf-documented behaviour. +2026-12-04: the host side for Lumen added as stream-v0.2.0 (below). + +## Host side (Lumen) + +Since stream-v0.2.0 DomiStream also holds the host's half of every protocol, for Lumen, Arena Domi's own streaming +host ([LUMEN-HOST-PLAN.md](LUMEN-HOST-PLAN.md) 3.1). The wire is the one this document describes; what is a choice of +ours on the host side is marked as such in the host notes: + +| Section | Host module | Host notes | +| :-- | :-- | :-- | +| 1.1-1.4 HTTP/HTTPS | `host::http` | strict request head and query parsing into typed routes; XML answers that the client's parsers accept; `PairStatus` 1 only over HTTPS with a paired certificate (1.2). Notes in the module docs | +| 1.5 Pairing | `host::pairing` | the mirror state machine with a pending-PIN slot; Tessera-trusted clients recorded without a PIN. Notes in the module docs | +| 2.2-2.4 RTSP | `rtsp::server` | 2.5: one session per launch, order, statuses, `Session`, DESCRIBE writer, strict ANNOUNCE parser | +| 3.1 ENet | `enet::host` | 3.1, "The accepting side, as stock ENet 1.3 does it" | +| 3.2-3.3 Control | `control::host` | 3.3, last paragraph: client frames, host messages, stop deadline | +| 5.2-5.3 Video | `video::packetizer` | 5.3, "Host side": FEC block split and parity | +| 6.2-6.4 Audio | `audio::packetizer` | 6.4, last paragraph: no parity until U16 | + +Both halves are tested against each other in one in-memory session (`crates/domistream/tests/session.rs`). Found +there, still open: the client's `ControlStream` refuses to send `START_B`, `PERIODIC_PING` and the IDR request +(bodies U10, 3.3). With `ControlStream` alone our client cannot start a stream on our host, and a host with a stop +deadline (60 s by default) would end the session; the session test sends the three with empty bodies over +`EnetClient` and `ControlCipher`, as `tools/gs-probe` does. The host keeps the client's `updateState` (1.5, U1) for the +logs without reading it. Interop with real clients (Arena Domi Remote, the Moonlight PC app) is unverified: it is measured black-box +(decision D2). **Tags** (details in the source log, [CLEAN_ROOM.md](CLEAN_ROOM.md)):