Files
DomiStream/docs/CLEAN_ROOM.md
T

12 KiB

Clean room

DomiStream is a clean-room implementation of the GameStream protocol (the one Moonlight clients and Sunshine hosts speak). The protocol is written from public protocol notes and our own measurements, never from the code of a GPL-licensed implementation. This file says what may be read, what may not, and logs every source used.

Allowed sources

Source Licence How we may use it
Wolf protocol docs and their sub-pages (pairing/HTTP, RTSP, control, RTP video, RTP Opus, input) Docs site: CC BY-SA 4.0 "except where otherwise noted"; repo: MIT (see research/open-point-2.md) Read for facts. Restate facts in our own words with a link. Never paste prose or diagrams. The diagram sources (PlantUML, bytefield, wavedrom) are part of the docs pages and may be read the same way.
Moonshine BSD-2-Clause May be read. Facts taken are logged below. Code is not copied; if a snippet is ever borrowed, it keeps Moonshine's copyright line and licence text in the file that holds it.
RFCs and standards (RTP RFC 3550, RTSP RFC 2326, SDP RFC 4566, Opus RFC 6716 / RFC 7845, AES FIPS 197, GCM/CBC NIST SP 800-38D/38A, PKCS #1 RFC 8017, X.509 RFC 5280) open standards Read freely.
Crate docs (docs.rs, crates.io, crate READMEs) per crate Read freely.
Our own measurements ours Captures through our own relay (tools/lab-relay). Mark allowed one capture on his PC (answer 16, 2026-11-25), done exactly as LAB_CAPTURE.md says; never his TV, never 192.168.100.217. Recordings stay local, on E: under E:\build\play-remotely\lab\, out of git; only facts and test vectors derived from them go in, with the date and setup.
Official Sunshine and Moonlight PC binaries in that capture GPL-3.0 (we only run them) Black-box peers: run, observe their traffic, their --help output, their own logs and the files/registry keys they write. Never open their source, never disassemble or decompile them.
READMEs and wikis of forbidden projects n/a For facts only (licence, release notes, compatibility statements). Never their source files.

Approved by Mark (answer 15, 2026-11-25): "Yes, with attribution"

Read for the wire format; anything borrowed beyond a fact is attributed in the file that holds it. GPL stays off limits, and a value with GPL provenance stays out even when one of these sources carries it.

Source Licence Why
Stock ENet MIT The ENet 1.3 wire format is documented nowhere else. Read at v1.3.18 (S-17).
tokio-enet BSD-2-Clause Pure-Rust ENet 1.3 that Moonshine uses with Moonlight clients (S-10, now approved).
fec-rs BSD-2-Clause Reed-Solomon whose README claims Moonlight compatibility; its matrix construction settles U14 (S-18).

Forbidden

Never open, read, paste or port code from: Sunshine, Moonlight (any client: Qt, Android, iOS, embedded, moonlight-tv), moonlight-common-c, Moonlight's ENet fork, Apollo, Vibeshine, Rubylight, chiaki (and forks of them). That also means their source files on GitHub. Their READMEs and wikis are fine for facts.

Second-hand GPL facts

Moonshine credits Sunshine for "groundwork" on the host side, and a few Moonshine comments cite Sunshine or moonlight-common-c as the origin of a value. We treat such a value as GPL-provenance: it is logged, never copied into DomiStream, and settled by our own measurement instead. Known cases:

Where in Moonshine What What we do
src/session/stream/audio/encoder.rs the fixed 2x4 Reed-Solomon parity matrix for audio FEC; the comment cites a moonlight-common-c file Not taken. I saw the constant while reading the file; it is not in this repo. U16 in PROTOCOL.md says how to measure it ourselves.
src/session/stream/control/mod.rs HDR mode payload "matches Sunshine's" struct Field layout logged as [M*], confirm by measurement before relying on it
fec-rs src/reed_solomon.rs tests (test_partial_eq_reflects_parity_matrix_changes) the same audio parity matrix as Moonshine's encoder Not taken, same rule. Seen while reading fec-rs on 2026-11-25.
src/rtsp.rs surround-params digit packing "matching moonlight-common-c" The Wolf example surround-params=21101 gives the same packing independently, so we use the Wolf source

How code gets written

  1. Every fact in PROTOCOL.md carries a source tag that points to the log below.
  2. A fact without a tag is UNKNOWN until a log entry or a measurement backs it.
  3. Code comments cite the PROTOCOL.md section, not the outside source directly.
  4. Anything borrowed (more than a fact) is attributed in the file that holds it and listed here.
  5. A PR that adds a source adds a row to the log in the same PR.

Source log

All entries by the DomiStream protocol engineer. Pinned commits are the ones read.

# Date Source What was taken
S-1 2026-11-25 Wolf: protocols index The six protocols, their default ports, which are encrypted (control AES-GCM 128, audio AES-CBC 128, video plain), that ports other than HTTP/S are dynamic. Licence footer (CC BY-SA 4.0).
S-2 2026-11-25 Wolf: HTTP/S pairing incl. its PlantUML diagram sources Phases 1-5; AES key from SHA-256(salt + PIN); the hash inputs of phase 2 and phase 4; field names plaincert, challengeresponse, serverchallengeresp, pairingsecret, pairchallenge, paired; phase 5 runs over HTTPS with the client certificate.
S-3 2026-11-25 Wolf: RTSP incl. diagram Method order OPTIONS, DESCRIBE, SETUP (audio, video, control), ANNOUNCE, PLAY; message layout (start line, CSeq, options, empty line, payload); example X-GS-ClientVersion: 14, a=fmtp:97 surround-params=21101.
S-4 2026-11-25 Wolf: control incl. bytefield sources ENet fork with IPv4 + IPv6; encrypted frame type 0x0001 / len / seq / 16-byte tag / payload, little-endian, seq used for the IV; message type codes; payloads of rumble, rumble triggers, motion event, RGB LED.
S-5 2026-11-25 Wolf: RTP video incl. diagrams PING to the negotiated port; packetSize default 1024 + 16-byte RTP header; 16-byte NV video header layout; flags (picture data 1, EOF 2, SOF 4); 8-byte frame prefix 01 37 63 68 61 72 73 73; FEC example (4 KB, 1024, 50 % = 4 + 2); parity packets have flags 0; IDR requests over control.
S-6 2026-11-25 Wolf: RTP Opus incl. diagrams 12-byte RTP header; 12-byte FEC header (shard index, payload type, base seq, base timestamp, SSRC); 4 data + 2 parity; AES-CBC with key and IV from the launch call, same key as control; PING.
S-7 2026-11-25 Wolf: input incl. bytefield sources INPUT_DATA layout (size BE, type LE); input type codes; layouts and example bytes for mouse move rel/abs, buttons, keys, scroll, hscroll, controller arrival, controller multi; key code table; button flags; controller types and capability bits.
S-8 2026-11-25 GitHub API for games-on-whales/wolf (/repos, /git/trees/beta, LICENSE, docs/README.adoc) Repo licence MIT; the docs live in docs/modules/protocols/pages/*.adoc of the same repo; latest tag v2026.11. No source files of Wolf were read.
S-9 2026-11-25 Moonshine at f184d5e3693e09c3a6ab1025bde6cdb67f36a6bc: LICENSE, README.md, Cargo.toml, src/clients.rs, src/crypto.rs, src/webserver/pairing.rs, src/webserver/mod.rs, src/rtsp.rs, src/session/stream/control/mod.rs, src/session/stream/audio/{mod,encoder}.rs, src/session/stream/video/{mod,packetizer,shard_batch}.rs Facts tagged [M] in PROTOCOL.md: pairing query names, AES-128-ECB, key = first 16 bytes of SHA-256(salt + PIN), 16-byte salt/challenge/secret, RSA PKCS#1 v1.5 SHA-256, "certificate signature" = X.509 signatureValue bytes; serverinfo, applist and launch XML and query fields; SDP attribute names, SETUP reply headers, encryption flag bits; control IV layout and direction bytes, START_B starts the streams, INVALIDATE_REF_FRAMES and termination layouts, ENet host settings; audio IV, payload types 97/127, millisecond timestamps; video RTP/NV header byte layout, FEC bit fields and block split, video encryption prefix and IV; PING payload. Moonshine depends on tokio-enet for the control channel.
S-10 2026-11-25 tokio-enet at 364628ed754760c99e0df7bcc88e479ad91475c4: README.md, CHANGELOG.md, src/protocol/{mod,header,commands}.rs Claims wire compatibility with C ENet 1.3.x, BSD-2; ENet command numbers 1-12, command sizes, header flags (compressed 1<<14, sent time 1<<15, session bits 12-13), 4-byte command header, big-endian fields. Approved (Mark, 2026-11-25, answer 15).
S-11 2026-11-25 crates.io API for enet, enet-rs, nsys-enet, rusty_enet, tokio-enet, enet-sys, henet, enet-cs-sys, fec-rs, reed-solomon-erasure and the RustCrypto crates Licences, versions, repositories (see research/open-point-2.md and the Cargo manifest).
S-12 2026-11-25 docs.rs: rusty_enet Transpiled from C ENet; caller-supplied Socket trait and HostSettings::time; optional crc32 checksum; MIT.
S-13 2026-11-25 fec-rs README GF(2^8) with polynomial 0x1D (0x11D), "compatible with the Moonlight streaming protocol", reconstruction supported, BSD-2.
S-14 2026-11-25 moonlight-common-c README (README only) Needs its bundled ENet; other ENet versions are incompatible; GPL-3.0.
S-15 2026-11-25 cgutman/enet repository page (description only) Forked from lsalzman/enet, has a moonlight branch. No files opened.
S-16 2026-11-25 Roadmap brief §3.2 (moonlight-android releases) Moonlight Android 12.1 added end-to-end stream encryption with Sunshine.
S-17 2026-11-25 Stock ENet v1.3.18 (2662c0d): LICENSE, include/enet/protocol.h, include/enet/enet.h (constants and peer states), host.c (enet_host_connect), peer.c (default ping and timeout setters), protocol.c (header and checksum handling, connect/verify connect session ids, retransmission timeout) MIT. Wire structs and sizes; header flags; checksum is an optional host setting (4 bytes after the header, no flag on the wire, seeded with the connect id); connect sends session ids 0xFF and channel 0xFF; defaults: MTU 1392, ping interval 500 ms, timeout limit 32 / minimum 5000 ms / maximum 30000 ms, window 4096-65536 derived from bandwidth.
S-18 2026-11-25 fec-rs at 402f41f970bb8c3ef7c88639821032e3b6460f63: LICENSE, README.md, build.rs (field tables), src/galois.rs (exp), src/matrix.rs (vandermonde), src/reed_solomon.rs (build_matrix, new) BSD-2. Field GF(2^8) with polynomial 0x11D, generator 2; systematic code whose parity rows are the Cauchy matrix P[j][i] = 1 / ((m + i) XOR j). Its tests also contain the GPL-provenance audio matrix (not taken).
S-19 2026-11-25 GitHub release API: Moonlight PC v6.2.0, Sunshine v2026.914.233613 Asset names, sizes and sha256 digests for the lab capture pins. Release metadata only.
S-20 2026-11-25 ArenaTV docs/research/sunshine-api.md and docs/research/this-pc.md (Domi's own research from LizardByte's docs) Sunshine's API calls, --creds, bind_address, port offsets, first-run behaviour, this PC's adapters and old install.