Files
DomiStream/docs/PROTOCOL.md

53 KiB
Raw Permalink Blame History

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). 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 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). The client's ControlStream sends START_B, PERIODIC_PING and the IDR request with empty bodies (lead's decision, 2026-12-04, since stream-v0.2.1): what Moonshine and Lumen read (3.3). Whether Sunshine reads more is still U10; START_A stays refused. The host keeps the client's updateState (1.5, U1) for the logs without reading it.

Measured: Arena Domi Remote against lumen-host [L1]

Our own black-box measurement (decision D2), 2026-12-04: Arena Domi Remote 0.1.2 (a GameStream client; its code is never read) in the Android emulator on the reference PC, against Arena's lumen-host L1 skeleton (DomiStream 337f6a7) on loopback, HTTP 48989 / HTTPS 48984, reached as 10.0.2.2:48989. Facts from lumen-host's request log and the operator's notes:

  • The client accepts a host entered as address:port and uses that port for HTTP; it then reached HTTPS on the port serverinfo gave (HttpsPort). While unpaired it polls /serverinfo over HTTP every 0.5 to 2.5 s.
  • Every request carries uniqueid=0123456789ABCDEF (the same on every request) and a parameter uuid with a fresh random UUID per request (not in sections 1.1-1.5; the host ignores it).
  • Pairing (U1, for this client): five requests in the order of 1.5, phase 4 (clientpairingsecret) before phase 5; phases 1-4 over HTTP, phase 5 (phrase=pairchallenge) over HTTPS with the client certificate. Every phase also carries devicename and updateState=1. With the code typed on the host the client showed the PC as paired about 12 s after the code was entered. DomiStream's host pairing (1.5) and lumen-host's TLS (TLS 1.3 offered, ALPN h2 and http/1.1, a self-signed client certificate) were accepted without change.
  • After pairing: /serverinfo and /applist over HTTPS; the client showed all 11 games of the applist.
  • Box art: /appasset?appid=<id>&AssetType=2&AssetIdx=0 over HTTPS for each app, retried about every 2 s while it fails (lumen-host L1 answered 404; the client showed no covers).
  • Launch (U4, for this client): /launch over HTTPS with appid, mode (1280x720x60), additionalStates=1, sops=1, rikey, rikeyid, localAudioPlayMode=0, surroundAudioInfo=196610, remoteControllersBitmap=0, gcmap=0, gcpersist=0, corever=1, plus uniqueid and uuid. An answer with HTTP status 503 is shown as "Failed to start (error 503)".

The other clients (the Moonlight PC app, Arena Domi TV) are measured when they connect.

L2 demo, the same client against lumen-host with streaming (2026-12-04) [L1]: pairing again in about 4 s from the typed code; box art from /appasset shown for all 11 games; /launch (1280x720x60, surroundAudioInfo=196610) answered with sessionUrl0=rtsp://127.0.0.1:49010. Then, for this client:

  • RTSP (U5): one TCP connection per request, and the client reads until the host closes the connection; a host that keeps it open makes every request wait for a timeout (measured: about 10.5 s per request against lumen-host before its fix; Arena PR #56 now closes after every answer). Requests: OPTIONS (target rtsp://0.0.0.0:49010; headers CSeq, X-GS-ClientVersion: 14, Host), DESCRIBE (adds Accept, If-Modified-Since), SETUP streamid=audio/0/0, streamid=video/0/0, streamid=control/13/0 (adds Transport; Session from the second SETUP on), ANNOUNCE (on streamid=control/13/0, 1491 bytes), PLAY.
  • ANNOUNCE (U6): 37 attributes, among them x-nv-vqos[0].bitStreamFormat = HEVC, viewport 1280x720, maxFPS 60, packetSize 1360, configuredBitrateKbps 10000, x-ss-general.encryptionEnabled 7, minRequiredFecPackets 2, maxNumReferenceFrames 1, dynamicRangeMode 0, encoderCscMode 2, stereo (surround.enable 0, 2 channels, mask 3), x-nv-aqos.packetDuration 5; no refPicInvalidation line. Also sent: x-ml-general.featureFlags, x-nv-video[0].rateControlMode, timeoutLengthMs, framesWithInvalidRefThreshold, initialBitrateKbps, initialPeakBitrateKbps, x-nv-vqos[0].bw.minimumBitrateKbps/maximumBitrateKbps, fec.enable, videoQualityScoreUpdateTime, x-nv-general.featureFlags, useReliableUdp, bllFec.enable, drc.enable, enableRecoveryMode, videoEncoderSlicesPerFrame, x-nv-clientSupportHevc, clientRefreshRateX100.
  • The client's own error text, when the RTSP handshake failed, named the GameStream default ports (TCP 48010, UDP 48000, 48010), not the ports it was using: it is a fixed text, not a statement of what it connected to.
  • /cancel answered 200 with the ok root brings the client back to its game list without an error.

Tags (details in the source log, CLEAN_ROOM.md):

Tag Source
[W1]-[W7] Wolf docs: index, pairing, RTSP, control, RTP video, RTP Opus, input (S-1 to S-7)
[M] Moonshine f184d5e (S-9). A host implementation: we mirror its behaviour for the client.
[M*] Moonshine, but the value has GPL provenance (Moonshine cites Sunshine or moonlight-common-c). Confirm by measurement before use.
[L1] our own black-box measurement of Arena Domi Remote 0.1.2 against lumen-host, 2026-12-04 ("Measured" above)
[T] tokio-enet 364628e (S-10), approved 2026-11-25
[E] stock ENet v1.3.18 2662c0d (S-17), MIT, approved 2026-11-25
[F] fec-rs README and source 402f41f (S-13, S-18), BSD-2, approved 2026-11-25
[RFC n] the RFC

Not in DomiStream: sockets, TLS, the clock, video decoding and Opus decoding. DomiStream hands the platform layer (ArenaTV: webOS NDL, Android MediaCodec, Windows D3D11VA) a complete Annex-B access unit per video frame and one Opus packet (or a "lost" marker) per audio packet, plus the Opus multistream configuration. Decoding, packet-loss concealment and output are the platform's job.


0. Overview

Six protocols [W1]:

Protocol Default port Transport Protection Purpose
HTTP TCP 47989 plain none server info, pairing
HTTPS TCP 47984 TLS, client certificate TLS app list, launch/resume/cancel, the last pairing step
RTSP TCP 48010 plain none negotiate the three streams
Control UDP 47999 ENet AES-128-GCM per message input, feedback, host events
Video UDP 47998 RTP none by default; optional AES-128-GCM [M] H.264 / HEVC / AV1
Audio UDP 48000 RTP AES-128-CBC Opus

All ports except HTTP/HTTPS can be changed by the host and reach the client through RTSP [W1].

Session order (client view): serverinfo (HTTP) → pair once (HTTP + one HTTPS step) → applist (HTTPS) → launch (HTTPS, hands over the stream keys) → RTSP OPTIONS, DESCRIBE, SETUP ×3, ANNOUNCE, PLAY → UDP PING to the video and audio ports + ENet connect to the control port → START_B on control → video and audio flow [W1][W3][M].


1. HTTP and HTTPS

Source: Wolf: HTTP/S pairing [W2], Moonshine src/webserver/ and src/clients.rs [M].

1.1 Common shape

  • Every call is a GET with a query string. Every response body is XML with one root: <root status_code="200">…</root>; a non-200 status_code is an error, possibly with a status_message attribute (UNKNOWN U27: attribute names on errors). [M]
  • Every call carries uniqueid=<client id> [M]. Our client id: 16 random hex characters, stored with the pairing (UNKNOWN U1: whether the host requires a particular form).
  • Binary values travel as hex in both directions [M]. Our parser accepts upper and lower case.
  • HTTPS: the host presents its certificate (the same one it sends as plaincert while pairing [M]); the client presents its own certificate. Only a client certificate that completed pairing may call HTTPS APIs [W2]. The client pins the host certificate: the TLS certificate must equal the paired plaincert byte for byte. TLS itself (version, ciphers) belongs to the platform layer (UNKNOWN U24: TLS versions Sunshine offers).

1.2 serverinfo

GET /serverinfo?uniqueid=… over HTTP (unpaired) or HTTPS (paired). PairStatus is 1 only over HTTPS with a paired certificate [M]. Elements under root [M]:

Element Meaning
hostname host name to show
appversion protocol version string, e.g. 7.1.431.-1; a negative fourth part marks the Sunshine-era protocol [M]
GfeVersion compatibility version string
uniqueid host id (stable across restarts)
HttpsPort, ExternalPort HTTPS and HTTP ports
mac MAC address for Wake-on-LAN (may be empty)
LocalIP host's address as it sees it
MaxLumaPixelsHEVC HEVC capability (0 = none)
ServerCodecModeSupport codec bitmask (UNKNOWN U25: bit meanings)
SupportedDisplayMode display modes (may be empty)
PairStatus 1 = this client is paired
currentgame running app id, 0 = none
state busy/free string, host-specific suffix (e.g. …_SERVER_BUSY, …_SERVER_FREE)

1.3 applist

GET /applist?uniqueid=… over HTTPS. One <App> per app with <AppTitle>, <ID> (decimal) and <IsHdrSupported> (0/1) [M]. Box art: GET /appasset?appid=<ID>… returns an image [M] (not used: Arena Domi TV shows Arena's own covers).

1.4 launch, resume, cancel

GET /launch?… over HTTPS. Parameters [M]:

Parameter Value
appid app ID from applist
mode <width>x<height>x<fps>, e.g. 1920x1080x60
rikey 16-byte AES key, hex. Used for control, audio and video encryption [W6][M]
rikeyid integer key id, decimal. Feeds the audio IV (section 6.3) [M]
hdrMode 0/1
surroundAudioInfo `(channel_mask << 16)
others UNKNOWN U4 (e.g. local audio playback, SOPS, gamepad mask, any version field)

Response [M]: <gamesession>1</gamesession> and <sessionUrl0>rtsp://<host>:<port></sessionUrl0> (UNKNOWN U4: what to assume when sessionUrl0 is missing; we use port 48010 of the same host).

GET /resume?rikey=…&rikeyid=… reattaches to the running app with fresh keys [M]. GET /cancel quits the running app [M]. GET /unpair forgets this client [M].

Key rule (ours): a fresh random rikey and rikeyid for every launch and resume. Counters behind the GCM nonces restart with each session (section 7), so a reused key would reuse nonces.

1.5 Pairing

The host shows nothing to the user in Arena Domi: arena-host submits the PIN to Sunshine locally. On the wire the PIN handshake is unchanged.

Inputs: PIN (4 ASCII digits [M]), the client's RSA certificate and key, randomness. Notation: ‖ concatenation, E_K / D_K AES-128-ECB with key K and no padding (inputs are whole blocks) [M], sig(cert) the raw signatureValue bytes of an X.509 certificate [M], Sign/Verify RSASSA-PKCS1-v1_5 with SHA-256 [M][RFC 8017].

Step Client sends Host answers Client then
1 (HTTP) /pair?uniqueid&devicename&updateState=1&phrase=getservercert&salt=hex(salt)&clientcert=hex(client cert PEM); salt 16 random bytes blocks until the PIN is entered on the host [M], then paired=1, plaincert=hex(host cert PEM) derives K = SHA-256(salt ‖ PIN)[0..16] [W2][M]; stores the host cert
2 (HTTP) clientchallenge=hex(E_K(C)); C 16 random bytes challengeresponse=hex(E_K(H_s ‖ S_c)), 48 bytes: H_s = SHA-256(C ‖ sig(host cert) ‖ secret_s), S_c the 16-byte host challenge [W2][M] decrypts, keeps H_s and S_c; cannot check H_s yet
3 (HTTP) serverchallengeresp=hex(E_K(H_c)), H_c = SHA-256(S_c ‖ sig(client cert) ‖ secret_c), secret_c 16 random bytes pairingsecret=hex(secret_s ‖ Sign_host(secret_s)) [W2][M] checks Verify_host(secret_s, signature) and SHA-256(C ‖ sig(host cert) ‖ secret_s) == H_s. Failure = wrong PIN or man in the middle: stop.
4 (HTTP) clientpairingsecret=hex(secret_c ‖ Sign_client(secret_c)) host checks H_c and the signature, answers paired=1 (or paired=0) [W2][M]
5 (HTTPS) phrase=pairchallenge, with the client certificate paired=1 [W2] pairing done; store host cert + host uniqueid

All step responses are <root status_code="200"><paired>1</paired>…</root> with the named element inside [M]. paired is 0 when the host refuses.

  • UNKNOWN U1: whether Sunshine requires devicename / updateState, and the order of steps 4 and 5 (Wolf's diagram: secret then HTTPS pairchallenge; Moonshine's comment lists pairchallenge first). We follow Wolf. Settle: lab capture of a pairing against Sunshine.
  • UNKNOWN U2: what Sunshine checks in the client certificate (key size, validity, subject). Our certificate: RSA-2048, SHA-256, self-signed, long validity, CN from the device name. Settle: lab pairing.
  • UNKNOWN U28: what a client should do after a failed step (call /unpair? just stop?). Settle: lab capture.

2. RTSP

Source: Wolf: RTSP [W3], Moonshine src/rtsp.rs [M], [RFC 2326].

2.1 Messages

Plain text over TCP [W3]. A request is a start line <METHOD> <target> RTSP/1.0, header lines Name: value, an empty line, then an optional payload; lines end in CRLF [W3]. A response starts RTSP/1.0 <status> <reason> [W3]. CSeq is always present and counts requests [W3]. Wolf's example carries X-GS-ClientVersion: 14 [W3] (UNKNOWN U5: which value Sunshine expects).

  • UNKNOWN U5: framing. Wolf calls the payload "anything after the headers". Our framer uses Content-Length when present and otherwise ends the message when the host closes the connection. Settle: lab capture (does Sunshine close the TCP connection after each reply, and does it send Content-Length?).
  • Target: rtsp://<host>:<port> from sessionUrl0 [W3][M].

2.2 Sequence [W3]

# Request Answer that matters
1 OPTIONS 200
2 DESCRIBE SDP payload with the host's capabilities (2.3)
3 SETUP audio Transport: server_port=<audio port>
4 SETUP video Transport: server_port=<video port>
5 SETUP control Transport: server_port=<control port>
6 ANNOUNCE SDP payload from the client with the stream settings (2.4); 200
7 PLAY 200

SETUP details [M]: the target's query is streamid=<audio|video|control>/… (Moonshine's example: streamid=control/13/0); a Transport header must be present (its value is not interpreted by Moonshine); the reply has Session: <id>;timeout = 90 and Transport: server_port=<port>.

  • UNKNOWN U5: the exact SETUP targets and Transport value Sunshine expects, whether later requests must echo Session, and the PLAY target.
  • UNKNOWN U7: whether Sunshine's SETUP replies carry extra headers the client must use (for example a payload for the UDP ping or a value for the ENet connect). Settle: lab capture.

2.3 DESCRIBE reply (host → client)

SDP-like lines, one attribute per line [M][RFC 4566]:

Line Meaning
a=x-ss-general.featureFlags:<n> bit 0x01 pen/touch events, 0x02 controller touch events [M]
a=x-ss-general.encryptionSupported:<n> bit 0x01 control V2, 0x02 video, 0x04 audio [M]
a=x-nv-video[0].refPicInvalidation:1 host can invalidate reference frames instead of sending an IDR [M]
a=rtpmap:98 AV1/90000 host can send AV1 [M]
a=fmtp:96 packetization-mode=1 H.264 packetization [M]
sprop-parameter-sets=… present, value not used [M]
a=fmtp:97 surround-params=<digits> one line per Opus configuration [W3][M]

surround-params is a run of single decimal digits: channel count, stream count, coupled-stream count, then one mapping digit per channel. Wolf's example 21101 = 2 channels, 1 stream, 1 coupled stream, mapping 0 1 [W3]. These are the Opus multistream parameters of [RFC 7845] §5.1.1 and go straight to the platform's Opus decoder. UNKNOWN U26: the host advertises 5.1/7.1 normal-quality mappings with a channel rotated [M*]; settle by capture.

2.4 ANNOUNCE payload (client → host)

SDP attribute lines a=<name>:<value>. Names the host reads [M]; values and the full required set are UNKNOWN U6:

Attribute What
x-nv-video[0].clientViewportWd, …clientViewportHt resolution
x-nv-video[0].maxFPS frame rate
x-nv-video[0].packetSize video packet size (default 1024 [W5])
x-nv-video[0].maxNumReferenceFrames 0 = host's choice when the decoder supports invalidation [M*]
x-nv-video[0].refPicInvalidation client supports invalidation
x-nv-video[0].dynamicRangeMode, …encoderCscMode HDR, colour space
x-nv-vqos[0].bitStreamFormat codec
x-nv-vqos[0].fec.minRequiredFecPackets minimum parity packets per block
x-nv-vqos[0].qosTrafficType, x-nv-aqos.qosTrafficType DSCP class
x-ml-video.configuredBitrateKbps bitrate
x-nv-aqos.packetDuration audio packet duration in ms
x-nv-audio.surround.enable, …numChannels, …channelMask, …AudioQuality audio layout
x-ss-video[0].chromaSamplingType 4:2:0 / 4:4:4
x-ss-general.encryptionEnabled encryption flags the client turns on (bits as in 2.3) [M]

Settle U6: lab capture of an ANNOUNCE accepted by Sunshine, then vary one attribute at a time.

2.5 Host side (Lumen): rtsp::server

Facts from Moonshine's host code (src/rtsp.rs, src/session/stream/video/mod.rs at f184d5e, S-30, S-31) and RFC 2326 (S-32); our own choices are marked as such.

Connections and framing. Moonshine reads one request per TCP connection and notes that Moonlight opens a connection per request [M]. So the host's state belongs to the launched session, not to a connection: every connection of that session feeds the same RtspServer (UNKNOWN U5 for other clients). A request without Content-Length has no payload (RFC 2326 4.4); the host's framer (RtspFramer::for_requests) ends it at the empty line. Every answer carries Content-Length (ours), so the client never waits for a close. Moonshine needs a parseable CSeq and closes without an answer when it is missing [M]; we answer 400 and let the caller close.

Order and statuses. Moonshine checks no order and no Session [M]. We enforce 2.2: OPTIONS, DESCRIBE, the three SETUPs (any order, each once: ours, U5), ANNOUNCE, PLAY. OPTIONS may come at any time and changes nothing else (RFC 2326 10.1). Moonshine answers only 200, 400 and 500 [M]; we use the RFC 2326 7.1.1 codes: 400 malformed request or ANNOUNCE payload, 451 a request the offer does not cover (codec, encryption bits, HDR, 4:4:4), 454 a Session that is not this session's, 455 a method out of order, 501 an unknown method (TEARDOWN, GET_PARAMETER...). A refused request changes no state; the caller decides whether to close.

Session. Moonshine sends the fixed id MoonshineSession and never reads it back [M]. We send a random id (8 bytes from the caller's RandomSource, hex; RFC 2326 3.4 asks for at least 8 random octets) as Session: <id>;timeout = 90 [M]. A Session header that is present must carry that id (454 otherwise, and before the first SETUP any id is wrong); a missing one is accepted unless the host config requires it (U5).

Answers [M]: OPTIONS Public (we list OPTIONS, DESCRIBE, SETUP, ANNOUNCE, PLAY; Moonshine leaves ANNOUNCE out); DESCRIBE the SDP below; SETUP needs a Transport header (400 without), takes the stream from the first streamid=<audio|video|control> of the target (400 otherwise) and answers Session and Transport: server_port=<port>; ANNOUNCE and PLAY answer with no payload.

DESCRIBE lines, in Moonshine's order [M]: a=x-ss-general.featureFlags:3, a=x-ss-general.encryptionSupported: 5 or 7 (7 when video encryption is on), sprop-parameter-sets=AAAAAU, a=x-nv-video[0].refPicInvalidation:1, a=rtpmap:98 AV1/90000, a=fmtp:96 packetization-mode=1, then one a=fmtp:97 surround-params= per Opus configuration. Moonshine writes all of them unconditionally; our writer leaves out the invalidation, AV1 and H.264 lines when the host does not offer them. HEVC, HDR and 4:4:4 have no DESCRIBE line (serverinfo, 1.2, U25). Moonshine rotates the 5.1/7.1 normal-quality mappings with a comment that cites GFE and Moonlight [M*]: not used, U26.

ANNOUNCE as Moonshine reads it. Missing or unparseable required attributes give 400 [M]; optional ones fall back to their default [M]. Our parser keeps the required set and the defaults, refuses out-of-range values instead of clamping, refuses a known attribute given twice, and counts unknown attributes.

Attribute Required? Default Accepted (ours unless tagged) Meaning
x-nv-video[0].clientViewportWd, …Ht yes [M] 1..=16384 resolution
x-nv-video[0].maxFPS yes [M] 1..=1000 (0 refused [M]) frame rate
x-nv-video[0].packetSize yes [M] 200..=65471 [M] (Moonshine clamps above its own cap; we refuse) video packet size
x-ml-video.configuredBitrateKbps yes [M] 1..=4294967 (×1000 must fit a u32 [M]) bitrate
x-nv-vqos[0].bitStreamFormat yes [M] 0 H.264, 1 HEVC, 2 AV1 [M]; others refused [M] codec
x-nv-vqos[0].fec.minRequiredFecPackets yes [M] 0..=255 minimum parity per block
x-nv-vqos[0].qosTrafficType, x-nv-aqos.qosTrafficType yes [M] any u32, kept raw (Moonshine: QoS off for 0 [M]) DSCP class
x-nv-aqos.packetDuration yes [M] 1..=120 ms (longest Opus packet, RFC 6716) audio packet duration
x-nv-video[0].maxNumReferenceFrames no 1 [M] any u32, raw (what 0 means is [M*]) reference frames
x-nv-video[0].refPicInvalidation no (Moonshine does not read it) 0: UNKNOWN U6 0, 1 client can invalidate
x-nv-video[0].dynamicRangeMode no 0 [M] any u32, raw; Moonshine: 0 SDR, 1 HDR [M]; a non-zero value needs the host's HDR offer (ours) U6
x-nv-video[0].encoderCscMode no 0 [M] any u32, raw; the bit layout is [M*] (Moonshine cites Sunshine) U6
x-ss-video[0].chromaSamplingType no 0 [M] 0 4:2:0, 1 4:4:4 [M] chroma
x-ss-general.encryptionEnabled no 0 [M] 0..=255, only offered bits (ours) 2.3 bits
x-nv-audio.surround.enable no 0 [M] 0, 1 when 0, the layout comes from launch's surroundAudioInfo [M]
x-nv-audio.surround.numChannels no 2 [M] 1..=8 channels
x-nv-audio.surround.channelMask no 0x3 [M] any u32, raw speaker mask
x-nv-audio.surround.AudioQuality no 1 [M] 0, 1 high quality

bitStreamFormat 0/1/2 [M] confirms the values our client sends (rtsp::sdp, previously a judgment). Payload caps (ours): 32 KiB, 1024 non-empty lines, 1024 bytes per line, 512 a= attributes; blanks around values are trimmed.

UNKNOWNs left for black-box measurement (Arena Domi Remote and the Moonlight PC app as Lumen's clients, decision D2): U5 (connection per request, the SETUP target form, whether clients echo Session, whether every client starts with OPTIONS), U6 (whether real clients always send the ten required attributes, refPicInvalidation's default, the meanings of dynamicRangeMode and encoderCscMode per client setting, whether qosTrafficType is always a number, how many attributes a real ANNOUNCE has), U26 (mapping rotation).


3. Control channel (ENet + AES-GCM)

Source: Wolf: control [W4], Moonshine src/session/stream/control/mod.rs [M], tokio-enet [T].

3.1 ENet

The control stream runs over a custom fork of ENet supporting IPv4 and IPv6 [W4]. The wire is stock ENet 1.3 [E][T] (all multi-byte fields big-endian):

  • Datagram = protocol header + up to 32 commands [E]. Header: peer_id u16 whose bits 15 and 14 are flags (1<<15 sent time present, 1<<14 compressed) and bits 12-13 the session id; then sent_time u16 (low 16 bits of the sender's millisecond clock) if flagged [E]. Peer id 0xFFF = "no peer yet" (the connect datagram) [E].
  • Checksum [E]: optional, a setting of the host on both ends; when on, 4 bytes follow the header (crc32 over the datagram with the field first set to the peer's connect id). Nothing on the wire says whether it is on, so both ends must agree.
  • Command header (4 bytes): command u8 (low 4 bits type, 0x80 acknowledge wanted, 0x40 unsequenced), channel_id u8 (0xFF for connection-level commands), reliable_sequence u16 [E].
  • Commands and total sizes [E]: 1 acknowledge (8: received reliable sequence, received sent time), 2 connect (48), 3 verify connect (44), 4 disconnect (8: data u32), 5 ping (4), 6 send reliable (6 + data), 7 send unreliable (8 + data), 8 send fragment (24 + data: start sequence, data length, fragment count, fragment number, total length, fragment offset), 9 send unsequenced (8 + data: unsequenced group), 10 bandwidth limit (12), 11 throttle configure (16), 12 send unreliable fragment (24 + data).
  • Connect fields [E]: outgoing peer id u16, incoming and outgoing session id u8 (a stock client sends 0xFF for both, "pick one"), MTU, window size, channel count, incoming and outgoing bandwidth, throttle interval, acceleration, deceleration, connect id (random), data u32. Verify connect has the same fields without data; the connect id must match [E].
  • Limits [E]: MTU 576-4096, window 4096-65536, channels 1-255, peer id ≤ 0xFFF, at most 1024 × 1024 fragments.
  • Stock defaults [E]: MTU 1392; window 65536 when bandwidth is unlimited; ping every 500 ms when idle; retransmission timeout = RTT + 4 × RTT variance (initial RTT 500 ms), doubling per retry; a peer is dropped when the oldest unacknowledged command is 30 s old, or once it has been sent 6 times (2^(attempts-1) ≥ 32, the timeout limit) and is at least 5 s old.

How the host uses it [M]: one peer per session; host created with a channel limit of 0x30; every host message is sent reliable on channel 0. Moonshine does this with stock-wire ENet and real Moonlight clients (see research/open-point-2.md).

What follows without a capture (our reasoning on [E][T][M]):

  • tokio-enet has no checksum and Moonlight clients work with it, so Moonlight clients run without the checksum. The checksum must match on both ends, and Sunshine works with the same clients, so Sunshine runs without it too. Same reasoning for compression: a client that compressed would fail against tokio-enet without a compressor.
  • So everything a Moonlight client sends parses as stock 1.3. What stays open is only what the fork might add on the host's sending side, which the fork-aware client accepts and a stock parser might not.

UNKNOWN U9 (narrowed): anything Sunshine's ENet sends that stock 1.3 does not; the channel count, MTU and connect data a client offers; whether the client sets non-default ping or timeout values. Settle: the lab capture's control port datagrams, decoded with our parser (LAB_CAPTURE.md). Until then our client offers stock defaults.

The accepting side, as stock ENet 1.3 does it [E] (S-17, S-34; DomiStream enet::host, the Lumen host):

  • A datagram addressed to 0xFFF is looked at only for a CONNECT at its start; anything else in it is ignored. A CONNECT asking for 0 or more than 255 channels is refused. A CONNECT repeated by a client whose connection already exists (same address, same connect id) is ignored: no second peer, no acknowledgement.
  • The CONNECT is not acknowledged; the host answers with a reliable VERIFY CONNECT on channel 0xFF (the connection channel's first reliable sequence number, 1), and the verify retires the client's connect.
  • Session ids: the host's outgoing id is the client's offered incoming id (or, for 0xFF, the slot's previous outgoing id) plus one, modulo 4, bumped once more if it equals the slot's previous outgoing id; the host's incoming id likewise from the client's offered outgoing id. A fresh slot has 0xFF for both, so a client offering 0xFF/0xFF gets 0/0. The verify carries incoming session = the host's outgoing and outgoing session = the host's incoming, i.e. both fields from the client's point of view; a sender puts its outgoing id in the header (only once the remote peer id is known), a receiver drops datagrams whose id is not its incoming id.
  • Verify fields: outgoing peer id = the host's own peer id (the client addresses it from then on); MTU = the client's clamped to 576-4096, then at most the host's; window = the client's, at most 65536 when the host's bandwidth is unlimited, clamped to 4096-65536; channel count = the client's, at most the host's channel limit; bandwidths = the host's own (0 = unlimited); throttle interval, acceleration and deceleration echoed; connect id echoed. The connect's data word is what the host's connect event reports.
  • The peer is connected when the client acknowledges the verify. Before that, data, pings and bandwidth or throttle commands from the client are not taken and not acknowledged (the client sends them again).
  • Acknowledgements: a command with the acknowledge flag is acknowledged only while connected, echoing the datagram's sent time; in a datagram without sent time such a command is handled but not acknowledged and the rest of the datagram is skipped. A failing command also ends the datagram.
  • Disconnect from the client while connected: acknowledged (if flagged), the connection closes with the client's data word. Ping, bandwidth limit and throttle configure need the connected state.
  • Unsequenced duplicates are dropped with a window of 1024 groups; groups up to 32 windows ahead move the window, older or farther ones are dropped.
  • The host pings a connected peer when nothing was received from it for the ping interval (500 ms by default) and no reliable command is in flight.

Not in DomiStream's host: the checksum and compression (see above), throttling what it sends by bandwidth, and unreliable fragments (dropped: every control message is small and reliable).

3.2 Encrypted frame

Every control message is wrapped [W4] (little-endian):

Offset Size Field
0 2 type, always 0x0001
2 2 length of the rest (4 + 16 + ciphertext)
4 4 sequence number, increasing
8 16 GCM tag
24 n ciphertext
  • Cipher: AES-128-GCM with the launch rikey [W4][W6].
  • Nonce (12 bytes) [M]: bytes 0-3 the sequence number (LE), bytes 4-9 zero, byte 10 the direction ('C' client to host, 'H' host to client), byte 11 'C'. No associated data [M].
  • Minimum frame: 24 bytes + at least the 4-byte message header [M].
  • UNKNOWN U11: the first sequence number and whether the host rejects gaps or repeats. Settle: lab capture. We start at 0, never reuse a number, and drop host frames whose number is not greater than the last accepted one (replay protection, ours).
  • UNKNOWN U10: whether anything is ever sent outside the wrapper once control encryption (V2) is negotiated. Our client refuses to stream with a host that does not offer control V2.

3.3 Messages (decrypted payload)

type u16 LE, length u16 LE (bytes that follow, must equal the rest of the payload [M]), then the body [W4].

Type Name Direction Body
0x0305 START_A client → host UNKNOWN U10. Moonshine has no such type; inside the encrypted frame it skips an unknown type [M]
0x0307 START_B client → host Moonshine reads no body [M]. The host starts video and audio when it arrives [M]; Moonshine's video receiver (and so its PING handling) only runs from then on [M]
0x0200 PERIODIC_PING client → host Moonshine reads no body [M]. Each one pushes the host's stop deadline out; Moonshine stops a stream after 60 s without one (its default) [M]
0x0201 LOSS_STATS client → host Moonshine ignores it [M]; body UNKNOWN U10
0x0204 FRAME_STATS client → host Moonshine ignores it [M]; body UNKNOWN U10
0x0206 INPUT_DATA client → host section 4
0x0302 IDR_FRAME (request) client → host Moonshine reads no body [M]
0x0301 INVALIDATE_REF_FRAMES client → host first u32, reserved u32, last u32, reserved 12 bytes, LE [M]
0x0100 TERMINATION host → client UNKNOWN U10
0x0109 TERMINATION (extended) host → client error_code u32 BE; 0x80030023 = graceful [M]
0x010b RUMBLE_DATA host → client unused 4, controller u16, low u16, high u16 [W4]
0x5500 RUMBLE_TRIGGERS host → client controller u16, left u16, right u16 [W4]
0x5501 MOTION_EVENT host → client controller u16, rate u16, type u8 (1 accelerometer, 2 gyroscope) [W4]
0x5502 RGB_LED host → client controller u16, r u8, g u8, b u8 [W4]
0x5503 trigger effect host → client UNKNOWN [M]
0x010e HDR_MODE host → client enabled u8 + 30 bytes HDR metadata (15 × u16 LE) [M*]

UNKNOWN U23: Wolf states "all data is little-endian" for the frame; we assume LE for the host event bodies too.

How Moonshine treats what a client sends on control [M]: a message whose type it does not know, or whose length field does not match, ends the session when it arrives outside the encrypted frame; inside the encrypted frame the same message is skipped, and so is a frame that fails decryption. Whether Sunshine reads bodies (and which) is what U10 still settles live: the probe sends empty bodies first (LIVE-INTEROP.md, table V).

How DomiStream's host side reads the client (control::host, for Lumen; ours, on [M] above): frames open with the client-to-host nonce; a frame that fails, or whose sequence number is not above the last accepted one, is dropped without moving the replay state (U11: the first number is not checked); a malformed message inside a good frame is skipped. Bodies of START_B, PERIODIC_PING and the IDR request are ignored, LOSS_STATS and FRAME_STATS are kept raw, INVALIDATE_REF_FRAMES reads first/last with missing bytes as 0, INPUT_DATA goes through section 4 (a layout we cannot read is reported, not fatal), every other type (START_A among them) is skipped. Only control V2 is spoken: a bare message outside the frame is dropped. Host messages: rumble, trigger rumble, motion event, RGB LED and the extended termination are sent, reliable on channel 0, numbered from 0; the plain TERMINATION (body U10) and HDR_MODE ([M*]) are refused until measured. Each PERIODIC_PING moves the stop deadline (default 60 s) out; when it passes, the host reports it once and the caller ends the session.


4. Input and gamepad packets

Source: Wolf: input [W7].

An INPUT_DATA message (inside the encrypted frame) [W7]:

Offset Size Field
0 2 0x0206 LE
2 2 length LE = 4 + size
4 4 size, big-endian = 4 + data length
8 4 input type, LE
12 n data

Input types [W7]: MOUSE_MOVE_REL 0x07, MOUSE_MOVE_ABS 0x05, MOUSE_BUTTON_DOWN 0x08, MOUSE_BUTTON_UP 0x09, KEY_DOWN 0x03, KEY_UP 0x04, MOUSE_SCROLL 0x0A, MOUSE_HSCROLL 0x55000001, TOUCH 0x55000002, PEN 0x55000003, CONTROLLER_MULTI 0x0C, CONTROLLER_ARRIVAL 0x55000004, CONTROLLER_TOUCH 0x55000005, CONTROLLER_MOTION 0x55000006, CONTROLLER_BATTERY 0x55000007, HAPTICS 0x0D, UTF8_TEXT 0x17.

Data layouts [W7]:

Type Data
MOUSE_MOVE_REL dx i16 BE, dy i16 BE
MOUSE_MOVE_ABS x i16 BE, y i16 BE, unused 2, width u16 BE, height u16 BE (client viewport)
MOUSE_BUTTON_DOWN/UP button u8: 1 left, 2 middle, 3 right, 4 side, 5 extra
KEY_DOWN/UP flags u8, key code u16 LE, modifiers u8, zero 2
MOUSE_SCROLL amount1 i16 BE, amount2 i16 BE, zero 2; hosts use amount1
MOUSE_HSCROLL amount i16 BE
CONTROLLER_ARRIVAL controller u8, type u8 (0 unknown, 1 Xbox, 2 PlayStation, 3 Nintendo), capabilities u8, supported buttons u32
CONTROLLER_MULTI below

Key codes are Windows virtual-key style (0x41 A … 0x5A Z, 0x70 F1 …, 0xA0/0xA1 shifts, …) [W7]. UNKNOWN U20: the example key packet carries A4 80 (LE 0x80A4) for LEFTALT 0xA4, so the high byte has a flag meaning; also the bit meanings of flags and modifiers (the example has modifiers = 0x04 with Alt).

Controller capability bits [W7]: analog triggers 0x01, rumble 0x02, trigger rumble 0x04, touchpad 0x08, accelerometer 0x10, gyro 0x20, battery 0x40, RGB LED 0x80.

CONTROLLER_MULTI data (26 bytes, LE) [W7]:

Offset Size Field
0 2 0x001A
2 2 controller number
4 2 active mask (bit per connected controller; mask 0 with number 1 = controller 1 unplugged)
6 2 0x0014
8 2 button flags (low 16 bits)
10 1 left trigger
11 1 right trigger
12 2 left stick X, i16
14 2 left stick Y, i16
16 2 right stick X, i16
18 2 right stick Y, i16
20 2 0x009C
22 2 button flags (high 16 bits; 0 in the legacy format)
24 2 0x0055

Buttons = low | (high << 16) [W7]: DPAD_UP 0x0001, DPAD_DOWN 0x0002, DPAD_LEFT 0x0004, DPAD_RIGHT 0x0008, START 0x0010, BACK 0x0020, LEFT_STICK 0x0040, RIGHT_STICK 0x0080, LEFT_BUTTON 0x0100, RIGHT_BUTTON 0x0200, HOME 0x0400, A 0x1000, B 0x2000, X 0x4000, Y 0x8000, PADDLE1-4 0x010000-0x080000, TOUCHPAD 0x100000, MISC 0x200000.

UNKNOWN U21: layouts of TOUCH, PEN, CONTROLLER_TOUCH, CONTROLLER_MOTION, CONTROLLER_BATTERY, HAPTICS and UTF8_TEXT (Wolf lists them without a layout). Not needed for Day 1 (gamepad + Magic Remote pointer + keys). UNKNOWN U22: meaning of the constants 0x1A, 0x14, 0x9C, 0x55, and whether the arrival packet has more bytes. Settle: lab capture with a gamepad.

Test vectors QA can build from [W7]

Full INPUT_DATA messages (plaintext, before the encrypted frame), hex:

Event Bytes
relative move dx = -1, dy = 0 06 02 0C 00 00 00 00 08 07 00 00 00 FF FF 00 00
absolute move x 1464, y 528, viewport 1919 × 1079 06 02 12 00 00 00 00 0E 05 00 00 00 05 B8 02 10 00 00 07 7F 04 37
left button down 06 02 09 00 00 00 00 05 08 00 00 00 01
key down, code 0x80A4, modifiers 0x04 06 02 0E 00 00 00 00 0A 03 00 00 00 00 A4 80 04 00 00
scroll -120 06 02 0E 00 00 00 00 0A 0A 00 00 00 FF 88 FF 88 00 00
horizontal scroll 30 06 02 0A 00 00 00 00 06 01 00 00 55 00 1E
controller 0, active mask 1, right stick Y -104 06 02 22 00 00 00 00 1E 0C 00 00 00 1A 00 00 00 01 00 14 00 00 00 00 00 00 00 00 00 00 00 98 FF 9C 00 00 00 55 00

5. RTP video

Source: Wolf: RTP video [W5], Moonshine src/session/stream/video/packetizer.rs [M], [RFC 3550].

5.1 Ping

The SETUP port is not where video arrives from: the client sends a PING from its own UDP socket to that port, and the host sends the stream back to the source address of the PING (NAT) [W5]. Moonshine accepts the 4 bytes PING [M]. UNKNOWN U8: Sunshine's ping payload and how often to repeat it. Settle: lab capture.

5.2 Packet

Each packet is packetSize + 16 bytes, packetSize from ANNOUNCE (default 1024) [W5]:

Offset Size Field
0 1 RTP byte 0, 0x90 [M] (version 2, extension bit set)
1 1 payload type, 0 [M]
2 2 sequence number, BE [W5][RFC 3550]
4 4 timestamp, BE (UNKNOWN U29: clock rate, probably 90 kHz)
8 4 SSRC, 0 [M]
12 4 reserved [W5]
16 4 stream packet index, LE (= RTP sequence << 8 [M])
20 4 frame index, LE [W5][M]; starts at 1 in a fresh session (Moonshine's note on what Moonlight-family clients expect [M], S-26; a host that started at 0 crashed Arena Domi Remote at its first frame, L2 demo)
24 1 flags: 0x01 picture data, 0x02 end of frame, 0x04 start of frame [W5]
25 1 reserved [W5]
26 1 multi-FEC flags, 0x10 [M] (UNKNOWN U15: meaning)
27 1 multi-FEC blocks: bits 4-5 this block's index, bits 6-7 the last block's index [M]
28 4 FEC info, LE: bits 4-11 FEC percentage, bits 12-21 shard index in block, bits 22-31 data shards in block [M]
32 n payload: packetSize - 16 bytes of frame data

A frame's data = an 8-byte frame header + the Annex-B bitstream (start codes 00 00 01 / 00 00 00 01) [W5]. Wolf shows the 8 bytes as the constant 01 37 63 68 61 72 73 73 [W5]; Moonshine fills them as header type u8 = 0x01, processing latency u16 LE, frame type u8 (1 predicted, 2 key, 5 first frame after a reference invalidation), last shard payload length u32 LE [M]. UNKNOWN U13: which one Sunshine sends. Our parser returns the 8 bytes raw plus the structured reading. The last data shard is zero-padded to full size [M]; the last-payload length (or the Annex-B content) tells where the frame really ends.

5.3 FEC

Reed-Solomon erasure code over GF(2^8), polynomial 0x11D [F] [W5]:

  • A frame splits into blocks (up to 4 [M]); each block has k data shards and m = ceil(k × percentage / 100) parity shards, k + m ≤ 255 [M]. Wolf's example: 4 KB at packetSize 1024 and 50 % → 4 data + 2 parity packets [W5].
  • Where the receiver gets the parameters: from every packet of the block: k = FEC info bits 22-31, shard index = bits 12-21 (0..k-1 data, k..k+m-1 parity), percentage = bits 4-11, block index and last block index from the multi-FEC byte. m follows from k and the percentage. The requested percentage and the minimum parity count are set by the client (x-nv-vqos[0].fec.minRequiredFecPackets, ANNOUNCE) [M].
  • Shards are the whole packets (all packetSize + 16 bytes, headers included) [M]. Parity packets have flags 0 [W5] and their RTP and NV header fields are written after the parity is computed [M], so parity bytes 0-31 are not parity. Consequence for the receiver: a recovered data shard's bytes 0-31 are garbage; use only its payload (offset 32 on) and take its place from the shard index.
  • Matrix (U14, settled from [F], to be confirmed by the capture): systematic: the data shards pass through, and parity shard j (0..m) is Σ_i P[j][i] · data_i with the Cauchy matrix P[j][i] = 1 / ((m + i) XOR j) over GF(2^8), polynomial 0x11D, generator 2 [F]. Nothing in the Wolf docs contradicts this: they only say Reed-Solomon with parity blocks [W5]. Examples (our own arithmetic): k = 4, m = 2: P = [[8e f4 47 a7], [f4 8e a7 47]]; k = 3, m = 1: P = [[01 8e f4]]. The capture settles it without any loss: parity packets are always sent, so our encoder must reproduce the captured parity bytes (offset 32 on) of every block.
  • Host side (Lumen, video::packetizer). The fewest blocks (at most 4) in which every block can carry the requested parity within k + m <= 255, split evenly: sizes differ by at most one, the larger blocks first (RFC 5052 9.1, as Moonshine's host does it [M], S-26); per block the least percentage, at or above the requested one, whose m reaches minRequiredFecPackets; Moonshine computes the same raised percentage ((minimum - 1) * 100 / k + 1, e.g. 101 % for 1 shard, 51 % for 2, 34 % for 3 with a minimum of 2) [M]; a frame too big for that gets the most parity that still fits (counted in the packetizer's stats). Data shards in order, then the block's parity, block by block; RTP sequence numbers run on across frames, one per packet. A capture of a real host still has to confirm the parity header fields: Moonshine patches only the RTP sequence, frame index, multi-FEC blocks byte and FEC info of a parity packet [M]; we write all header fields.
  • The audio code is not this matrix (section 6.4).

5.4 Feedback

On an unrecoverable frame the client asks for an IDR frame or, when the host advertised refPicInvalidation, sends INVALIDATE_REF_FRAMES with the lost range (section 3.3) [W5][M].


6. RTP audio (Opus)

Source: Wolf: RTP Opus [W6], Moonshine src/session/stream/audio/encoder.rs [M], [RFC 6716].

6.1 Ping

As for video: the client pings the SETUP audio port and audio comes back to the ping's source address [W6].

6.2 Packets

RTP header, 12 bytes [W6]: byte 0 0x80 [M], payload type 97 for audio and 127 for FEC parity [M], sequence BE, timestamp BE, SSRC 0 [M]. The timestamp counts milliseconds and advances by the packet duration (x-nv-aqos.packetDuration) per packet [M].

Data packet: RTP header + one Opus packet [RFC 6716], encrypted (6.3).

Parity packet [W6]: RTP header (sequence continues after the 4 data packets [M]) + a 12-byte FEC header + parity:

Offset Size Field
12 1 shard index (0 or 1) [W6][M]
13 1 payload type of the protected packets, 97 [M]
14 2 base sequence number, BE [W6][M]
16 4 base timestamp, BE [W6][M]
20 4 SSRC [W6]
24 n parity bytes

6.3 Encryption

AES-128-CBC with rikey [W6]. IV (16 bytes) [M]: u32 BE (rikeyid + sequence number) then 12 zero bytes; PKCS#7 padding [M]. UNKNOWN U17: Wolf says audio is always encrypted; Moonshine only when the audio flag is negotiated. Settle: lab capture.

6.4 FEC

Every 4 data packets are followed by 2 parity packets [W6]. A block is the 4 data packets whose sequence numbers start at a multiple of 4 [M]; the base sequence and timestamp in the FEC header are the first data packet's [M]. Shards are the encrypted payloads (all 4 the same length, constant-bitrate Opus) [M]. A lost data packet is rebuilt from any 4 of the 6 packets; its RTP header comes from the base values (sequence = base + index, timestamp = base + index × duration) [M]. DomiStream waits for the jitter budget (loss_timeout) before rebuilding a missing packet, so a packet that arrives late is played as sent rather than as a rebuilt copy.

UNKNOWN U16 (blocks audio FEC): the parity matrix. It is a fixed 2 × 4 matrix over GF(2^8), not the default construction of the RS library Moonshine uses [M]. The only value we have seen carries GPL provenance and is not used (see CLEAN_ROOM.md). Settle by measurement: capture a few audio blocks from a lab host and solve for the 8 coefficients (each parity byte is a linear combination of the 4 data bytes at the same offset: 4 unknowns per parity row, so a handful of byte positions gives a unique solution). Until then, audio loss falls back to the platform's packet-loss concealment.

Host side (Lumen, audio::packetizer): no parity packets until U16 is settled (AudioParity::None; the API leaves room for a parity variant). The first sequence number is a multiple of 4, a block start, because our receiver counts from the first packet's block start and would otherwise report the 1 to 3 numbers before it as lost.

6.5 Decoding

Not DomiStream. DomiStream outputs each Opus packet (or a "lost" marker) in sequence order plus the multistream configuration from surround-params (section 2.3). ArenaTV decodes (NDL or libopus on webOS, MediaCodec on Android) and does concealment.


7. Stream encryption

Stream When Cipher Key Nonce / IV
Pairing always AES-128-ECB + RSA PKCS#1 v1.5 SHA-256 SHA-256(salt ‖ PIN)[0..16] none (ECB)
HTTPS after pairing TLS (platform), pinned host cert, client cert
Control control V2 flag (0x01) AES-128-GCM, 16-byte tag, no AAD rikey seq LE ‖ 6 zero ‖ dir (C/H) ‖ C [M]
Audio audio flag (0x04) [M] (always, per [W6]) AES-128-CBC, PKCS#7 rikey BE(rikeyid + seq) ‖ 12 zero [M]
Video video flag (0x02) [M] AES-128-GCM, 16-byte tag, no AAD rikey 8-byte LE counter ‖ 3 zero ‖ V [M]

Negotiation: the host lists what it supports in DESCRIBE (x-ss-general.encryptionSupported), the client turns on what it wants in ANNOUNCE (x-ss-general.encryptionEnabled) [M].

Encrypted video packet [M]: IV 12 bytes ‖ frame number u32 LE ‖ tag 16 bytes ‖ ciphertext, where the ciphertext is the whole plaintext packet of section 5.2; FEC is applied before encryption, so the client decrypts first. UNKNOWN U19: whether Sunshine uses this exact layout (Moonlight Android 12.1 added end-to-end encryption with Sunshine, S-16). Settle: lab capture with video encryption on.

Our policy (Day 1: "stream encryption on"): request every flag the host supports; refuse to stream without control V2; show in the stats overlay whether video is encrypted. A new rikey/rikeyid per launch and resume, because the three nonce spaces (control C/H, video V) share one key and their counters restart per session. On top of this, traffic goes through the Via Domi tunnel whenever Via is installed (roadmap J6).


8. UNKNOWNs

B = blocks a Day 1 stream against Sunshine. Almost everything is settled by one lab capture (a GameStream client and Sunshine on a lab machine, not Mark's PC, his Sunshine or his TV); the column says what to look at.

# What B Settle by
U1 Pairing query params beyond uniqueid/phrase/salt/clientcert; order of steps 4 and 5 B capture a pairing
U2 Client certificate requirements B lab pairing with our certificate
U4 Full launch parameter set; default when sessionUrl0 is missing B capture a launch
U5 RTSP framing, X-GS-ClientVersion, SETUP targets and Transport, Session echo, PLAY target B capture the RTSP exchange
U6 ANNOUNCE attributes and values Sunshine requires B capture, then vary one at a time
U7 Extra headers in SETUP replies B capture
U8 UDP ping payload and repeat interval B capture
U9 Narrowed (3.1): only what Sunshine's ENet may add when sending; the client's channel count, MTU, connect data B capture, decode with our parser
U10 Narrowed (3.3): Moonshine reads no body from START_B, PERIODIC_PING or the IDR request and ignores START_A, LOSS_STATS and FRAME_STATS; what Sunshine reads, the ping interval it needs, TERMINATION's body B live sitting: empty bodies first, then the hex variants
U11 First control sequence number; host's replay rules capture
U13 Video frame header: Wolf's constant or Moonshine's fields capture
U14 Video RS matrix: settled (5.3, Cauchy from fec-rs) capture confirms: our parity = captured parity
U15 Multi-FEC flags 0x10 capture
U16 Audio RS parity matrix (audio plays without it) capture, solve over GF(2^8)
U17 Audio encryption always or only when negotiated B capture
U19 Video encryption layout against Sunshine capture with video encryption on
U20 Key code high byte, flags, modifiers bits capture with a keyboard
U21 TOUCH, PEN, controller touch/motion/battery, HAPTICS, UTF8_TEXT layouts capture (Day 5 scope)
U22 CONTROLLER_MULTI constants, arrival packet length capture with a gamepad
U23 Endianness of host event bodies capture rumble
U24 TLS versions and ciphers capture (platform concern)
U25 ServerCodecModeSupport bits serverinfo from hosts with known codecs
U26 Surround mapping rotation capture 5.1
U27 Error attributes on non-200 XML capture a refused call
U28 Client behaviour after a failed pairing step capture a wrong PIN
U29 Video RTP clock rate capture

9. Notes on the Wolf docs

  • The video FEC example sums the overhead as "32 * 6 + 2048 = 2248 bytes"; the arithmetic gives 2240.
  • The button table lists both HOME and SPECIAL_FLAG as 0x0400.
  • The key table prints NUMPAD PLUS as x6B (meaning 0x6B).