[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
+14 -8
View File
@@ -38,9 +38,10 @@ launch:
--ping-ms <n> 500 (UDP ping to the video and audio ports)
--enet-channels <n> 1 --enet-mtu <n> 1392 --enet-connect-data <n> 0
--control-channel <n> 0 --first-control-seq <n> 0
Control message bodies (U10; defaults from Moonshine, which reads no body from any of them, PROTOCOL.md 3.3):
--start-a <hex|empty|none> empty --start-b <hex|empty|none> empty
--periodic-ping <hex|empty> off --periodic-ping-ms <n> 100
--idr <hex|empty> off (body of an IDR request sent on frame loss)
--periodic-ping <hex|empty|none> empty --periodic-ping-ms <n> 500
--idr <hex|empty|none> empty (IDR request on frame loss, unless --rfi and the host offers invalidation)
--nudge-mouse send one relative mouse move +1/-1 after the first decodable frame
";
@@ -157,9 +158,9 @@ impl Default for Options {
first_control_seq: 0,
start_a: Body::Bytes(Vec::new()),
start_b: Body::Bytes(Vec::new()),
periodic_ping: Body::None,
periodic_ping_ms: 100,
idr: Body::None,
periodic_ping: Body::Bytes(Vec::new()),
periodic_ping_ms: 500,
idr: Body::Bytes(Vec::new()),
nudge_mouse: false,
}
}
@@ -375,7 +376,12 @@ mod tests {
assert_eq!((o.width, o.height, o.fps, o.bitrate_kbps, o.packet_size), (1920, 1080, 60, 20_000, 1024));
assert_eq!((o.encryption, o.seconds, o.enet_channels, o.enet_mtu), (7, 20, 1, 1392));
assert_eq!(o.start_a, Body::Bytes(vec![]));
assert_eq!(o.periodic_ping, Body::None);
// U10 candidates (PROTOCOL.md 3.3): every body empty, a ping every 500 ms.
assert_eq!(
(o.start_b, o.periodic_ping, o.idr),
(Body::Bytes(vec![]), Body::Bytes(vec![]), Body::Bytes(vec![]))
);
assert_eq!(o.periodic_ping_ms, 500);
assert!(!o.wrong_pin && !o.nudge_mouse && !o.rfi);
}
@@ -406,11 +412,11 @@ mod tests {
#[test]
fn launch_options_parse_and_are_ranged() {
let o = ok("launch 1 --host ::1 --out o --mode 1280x720x30 --codec hevc --audio 5.1 --seconds 600 \
--start-b 0a0B --start-a none --idr empty --enet-channels 48 --control-channel 47 --hdr --rfi")
--start-b 0a0B --start-a none --idr none --enet-channels 48 --control-channel 47 --hdr --rfi")
.options;
assert_eq!((o.width, o.height, o.fps), (1280, 720, 30));
assert_eq!((o.codec, o.audio), (VideoCodec::Hevc, AudioLayout::Surround51));
assert_eq!((o.start_a, o.start_b, o.idr), (Body::None, Body::Bytes(vec![0x0a, 0x0b]), Body::Bytes(vec![])));
assert_eq!((o.start_a, o.start_b, o.idr), (Body::None, Body::Bytes(vec![0x0a, 0x0b]), Body::None));
assert!(o.hdr && o.rfi);
assert!(err("launch 1 --host ::1 --out o --seconds 601").contains("outside"));
assert!(err("launch 1 --host ::1 --out o --encryption 8").contains("outside"));
+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();