[probe] U10 candidates from Moonshine: empty control bodies as defaults; run book P3/P4

Moonshine f184d5e (BSD-2, CLEAN_ROOM S-21) reads no body from START_B, PERIODIC_PING or the IDR request, ignores
LOSS_STATS and FRAME_STATS, does not know START_A (skipped inside the encrypted frame, fatal outside it), and stops a
stream after 60 s without a ping. No GPL-provenance value taken.

- Probe defaults: START_A and START_B empty, PERIODIC_PING empty every 500 ms, an empty IDR request on frame loss;
  every body stays overridable by hex or `none`.
- Tests: the candidates' plaintext headers, their sealed frame layout and Moonshine's client-to-host IV, and the
  INVALIDATE_REF_FRAMES field offsets Moonshine reads.
- PROTOCOL.md 3.3 and the U10 row narrowed with the [M] facts.
- LIVE-INTEROP.md: P3 decided (dev-only `sunshine-api` in arena-host behind a never-shipped feature, credentials from
  Custos), P4 done, table V rewritten without guessed bodies, first launch 90 s to outlast a 60 s ping deadline, the
  black-box list pointed at PLAY-REMOTELY's handover, §8 and §15 (§17 is the installer spec).
This commit is contained in:
2026-11-30 11:01:41 +01:00
parent 07ccff4241
commit 3e09dbc09a
5 changed files with 101 additions and 29 deletions
+54 -1
View File
@@ -35,7 +35,9 @@ use crate::fec::{VideoFecCheck, VideoOutcome};
use crate::log::{J, Kind, Log, bytes, hex};
use crate::{Ctx, rtsp};
/// Control message types the probe sends with command-line bodies (PROTOCOL.md 3.3).
/// Control message types the probe sends with command-line bodies (PROTOCOL.md 3.3). The default bodies are empty:
/// Moonshine reads no body from START_B, PERIODIC_PING or the IDR request and skips an unknown type such as START_A
/// inside the encrypted frame (U10, [M] S-21); Sunshine is settled live.
const START_A: u16 = 0x0305;
const START_B: u16 = 0x0307;
const PERIODIC_PING: u16 = 0x0200;
@@ -1135,6 +1137,57 @@ mod tests {
assert!(raw_message(IDR_REQUEST, &vec![0; 70_000]).is_none());
}
/// The U10 candidates the probe sends by default, as plaintext messages: a bare 4-byte header each, which is
/// what Moonshine's parser accepts (length field = bytes after the header).
#[test]
fn default_candidates_are_bare_headers() {
let o = Options::default();
let cases = [
(START_A, &o.start_a, [0x05, 0x03, 0x00, 0x00]),
(START_B, &o.start_b, [0x07, 0x03, 0x00, 0x00]),
(PERIODIC_PING, &o.periodic_ping, [0x00, 0x02, 0x00, 0x00]),
(IDR_REQUEST, &o.idr, [0x02, 0x03, 0x00, 0x00]),
];
for (t, body, want) in cases {
let m = raw_message(t, body_of(body).unwrap()).unwrap();
assert_eq!(m, want);
let parsed = parse_message(&m).unwrap();
assert_eq!((parsed.message_type, parsed.body.len()), (t, 0));
}
}
/// Sealed with a test key, each candidate is the documented encrypted frame (PROTOCOL.md 3.2): type 0x0001,
/// length 4 + 16 + 4, the sequence LE, tag, 4 bytes of ciphertext; the nonce is Moonshine's client-to-host IV
/// (sequence LE, six zeros, 'C', 'C').
#[test]
fn sealed_candidates_follow_the_frame_layout() {
use domistream::control::frame::nonce;
let cipher = ControlCipher::new([0x11; 16]);
for (seq, t) in [(0u32, START_A), (1, START_B), (2, PERIODIC_PING), (0x0102_0304, IDR_REQUEST)] {
let plain = raw_message(t, &[]).unwrap();
let frame = cipher.seal(seq, Direction::ClientToHost, &plain).unwrap();
assert_eq!(frame.len(), 28);
assert_eq!(frame[..4], [0x01, 0x00, 24, 0x00]);
assert_eq!(frame[4..8], seq.to_le_bytes());
assert_eq!(cipher.open(Direction::ClientToHost, &frame).unwrap(), (seq, plain));
let mut iv = [0u8; 12];
iv[..4].copy_from_slice(&seq.to_le_bytes());
iv[10] = b'C';
iv[11] = b'C';
assert_eq!(nonce(seq, Direction::ClientToHost).unwrap(), iv);
}
}
/// The crate's INVALIDATE_REF_FRAMES (sent with --rfi) puts `first` and `last` where Moonshine reads them:
/// message bytes 4..8 and 12..16, little-endian.
#[test]
fn invalidate_ref_frames_layout() {
let m = encode_client_message(&ClientMessage::InvalidateRefFrames { first: 7, last: 0x0A0B_0C0D }).unwrap();
assert_eq!(m[..2], [0x01, 0x03]);
assert_eq!(m[4..8], 7u32.to_le_bytes());
assert_eq!(m[12..16], 0x0A0B_0C0Du32.to_le_bytes());
}
#[test]
fn clock_conversions_round_trip() {
let epoch = StdInstant::now();