fix(desktop): build browser RtcPeerConnection with domain ICE servers #77
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/VAPP-67-browser-ice-config"
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?
What
The browser desktop viewer built its
RtcPeerConnectionwithRtcPeerConnection::new()(emptyiceServers), so it only ever gathered host / mDNS candidates and never a server-reflexive (srflx) one. VS-82 already wired the agent side: the agent receives the domain ICE config and its answer SDP carriessrflxcandidates. But with nothing to pair against on the browser side, every candidate pair wentfailed, the WebRTC data channel never opened, and the desktop tab stayed black for any cross-network (NAT'd) agent.This is the browser half of VAPP-67: source the browser's
iceServersfrom the samedomain.ice_serversthe agent is pushed, so both peers gathersrflx(andrelaywhen TURN is set) and ICE can pair.How
open_relay_tunnel(server fn) now reads theserverinfoframe'swebrtcconfig(the{"iceServers":[...]}RTCConfigurationobject) and returns it onTerminalTunnel.webrtc_config.serverinfois captured before theauthcookierequest because vervain-server pushes it unconditionally as the first frame on connect, before any client action, so the request-style skim would otherwise discard it.attach->mount->build->RtcCtx, and the newRtcCtx::new_peer_connectionbuilds the peer connection withnew_with_configuration({"iceServers":[...]})when present.serverinfoomitswebrtcconfig) falls back toRtcPeerConnection::new()(host candidates only), matching the agent's defaultIceConfigand prior behavior. Awebrtcconfigthat does not parse as a JSON object falls back the same way with a console warning rather than failing the upgrade.Invariant sweep
Every WebRTC-offering peer must build its
RtcPeerConnectionwith the domainiceServersfromserverinfo, falling back to unconfigured only when none is supplied. EveryRtcPeerConnectionconstruction site in the client (all indesktop.rs) now routes throughnew_peer_connection. The terminal and files tunnels are WebSocket-only (no WebRTC upgrade), so they are N/A.Testing
just pre-commitgreen: fmt, clippy-D warnings,cargo check(server +wasm32-unknown-unknown), and 43 tests pass.Notes
Relates to VS-82 (agent side). The client cannot be exercised headless here, so the
about:webrtcacceptance criteria (populatedRTCConfiguration.iceServers,srflx/relaybrowser candidates, ICE reachingconnected) still want a manual cross-network check on a deployed build.#VAPP-67
The desktop viewer built its RtcPeerConnection with RtcPeerConnection::new() (empty iceServers), so it only gathered host / mDNS candidates and never a server-reflexive one. The agent side (VS-82) already receives the domain ICE config and gathers srflx candidates, but with nothing to pair against on the browser side every candidate pair failed, the data channel never opened, and the desktop tab stayed black across NAT. Capture the WebRTC ICE configuration from the serverinfo frame (webrtcconfig, the same domain.ice_servers source the agent is pushed) in open_relay_tunnel and thread it to the desktop viewer, which now constructs the peer connection with new_with_configuration({"iceServers":[...]}) when present. serverinfo is read before authcookie because vervain-server pushes it unconditionally as the first frame on connect, before any client action, so the request-style authcookie skim would otherwise discard it. When the domain configures no ICE servers the serverinfo frame omits webrtcconfig, and the viewer falls back to an unconfigured connection (host candidates only), matching the agent's default IceConfig and prior behavior. A webrtcconfig that does not parse as a JSON object falls back the same way with a console warning rather than failing the upgrade. Only the desktop tunnel (usage 2) consumes the config; the terminal and file tunnels ignore it. #VAPP-67