feat(vnc-native): in-process RFB 003.008 server (VA-21) #21
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/vnc-native-va-21"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes VA-21. Adds
USAGE_VNC_NATIVE = 8tunnel mode: the agent speaks RFB 003.008 in-process, reusingmeshagent_kvmfor capture and input. No external helper binary - contrasted with VA-19'sx11vnc/wayvncbridge, this PR delivers the single-static-binary VNC story called out in the issue's acceptance criteria.Scope picked: "Full acceptance" per the in-thread question.
What's in the diff
crates/meshagent/src/host/vnc_native/(new):proto.rs: PixelFormat (BGRX LE default), message codes (server + client), encoding numbers (Raw / CopyRect / Hextile / ZRLE / DesktopSize), security types (None / VeNCrypt), framing helpers.handshake.rs: ProtocolVersion negotiation (rejects pre-003.008), security-type advertisement (VeNCrypt + None), SecurityResult, ClientInit / ServerInit.tls.rs: VeNCrypt sub-handshake withX509Nonesub-type, ephemeral self-signed cert viarcgen, rustlsTlsAcceptorreusing the workspace ring provider.encoding/raw.rs: RFC 6143 §7.7.1.encoding/hextile.rs: RFC 6143 §7.7.4 with histogram-based BG / FG / SubrectsColoured selection and cost-vs-Raw decisioning.encoding/zrle.rs: RFC 6143 §7.7.6. Persistentflate2::Compressstate across rectangles; one Sync flush per encode emits the 6-byte sync marker without ending the deflate stream.input_map.rs: keysym ->meshagent_kvm::key_event(via the existing0x<hex>keysym parser); pointer button-mask ->mouse_button/mouse_move.server.rs: top-level state machine. 64x64 change-detection tile grid feeds the picked encoder (preference: ZRLE > Hextile > Raw, picked from clientSetEncodings). DesktopSize pseudo-rect on resolution change. Parameterised over aCaptureSourcetrait so tests inject a stub frame source.ws_io.rs: adapter fromWebSocketStreamtoAsyncRead + AsyncWriteviatokio::io::duplexand a background pump task. Re-useshost::tunnel::control_echofor the rendezvous rtt probe.crates/meshagent/src/host/tunnel.rs:USAGE_VNC_NATIVEconstant, dispatch arm, docstring entry.crates/meshagent/src/host/mod.rs: register the new module.crates/meshagent/Cargo.toml: addflate2.crates/meshagent-kvm: promoteRawFrame+PixelLayoutto the public surface and addcapture_raw_frame()for uncompressed pixel access (the existing JPEG tile-diff stream is unchanged).README.md: new "Native RFB / VNC server" bullet in Runtime dependencies (no system dep; rustls +rcgencome from existing workspace deps).Acceptance checklist
vncrypt_tls_handshake_completes_against_rustls_clientdrives the full path).AcceptAllcert verifier; in production the operator's VNC viewer accepts the self-signed cert via its usual trust prompt).input_maptranslation tested; X11 / Wayland injection delegates tomeshagent_kvmand is already covered there).meshagent-kvmtile-diff tests.Test plan
cargo test --workspace --lib(32 new vnc_native tests pass; full suite green).cargo clippy --workspace --all-targets -- --deny warnings(clean).cargo fmt --all --check(clean).just pre-commit(full docker check: fmt + clippy + build + tests, all green).USAGE_VNC_NATIVE = 8.