headplane icon indicating copy to clipboard operation
headplane copied to clipboard

[Feature Request] Wasm VNC/RDP client

Open axwnet opened this issue 1 month ago • 2 comments

Description

Just like the ssh WASM client, it would be nice if VNC and RDP would work so easily too.

https://github.com/rickli-cloud/headscale-console implements this.

axwnet avatar Oct 30 '26 08:10 axwnet

Feasibility analysis: WASM VNC/RDP client

No duplicate or directly related issue exists. The request is reasonable, and Headplane's existing Browser SSH is already most of the infrastructure — but VNC and RDP are not small additions, and two product decisions are needed before this becomes a concrete plan.

What the reference project does

headscale-console splits each protocol at a clean seam:

  • Go/WASM owns the tailnet and exposes raw TCP as an RTCDataChannel-shaped object (IpnRawTcpChannel) — no WebRTC involved, just an interface noVNC and IronRDP already consume.
  • VNC: JS handles the protocol (noVNC) and renders.
  • RDP: JS pipes bytes into a second WASM module (IronRDP, Rust) that does TLS, RDP, and rendering.

SSH there is the same as Headplane's: Go owns the whole stack.

How this maps onto Headplane

Reusable today:

  • The tailnet join, pre-auth key generation, ephemeral node lifecycle, and agent cleanup in app/routes/ssh/page.tsx (loader) and app/routes/ssh/wasm.client.ts are protocol-agnostic and can be shared.
  • cmd/hp_ssh/wasm_js.go:432 already dials arbitrary TCP through dialer.UserDial; the netstack dialer is wired for any address (wasm_js.go:137-159).
  • The windowed /ssh/:id route + machine menu entry (app/routes/machines/components/menu.tsx:45) is the pattern to copy for /vnc/:id and /rdp/:id.

Missing:

  1. A generic dial in the WASM shim. Today only ipn.ssh is exported (wasm_js.go:213). A dial(host, port) returning { write, close, setReadFn } (mirroring the jsSSHSession plumbing) is the one Go-side primitive both protocols need. This is the smallest, most reusable piece and the natural first PR.
  2. Browser protocol clients. noVNC (JS, MIT) for VNC; IronRDP for RDP. IronRDP is a Rust→WASM module, so the build gains a second toolchain and a sizeable binary alongside hp_ssh.wasm. That is the biggest cost and the main reason to split VNC and RDP into separate efforts.
  3. Port discovery. SSH is offered when node.hostInfo.sshHostKeys is present (menu.tsx:46). VNC (5900) and RDP (3389) have no Headscale metadata. Something has to decide when the buttons show: user-entered host:port, agent probing, or a per-node config list. This is an open design question.
  4. Credential UX. Unlike Tailscale SSH, VNC and RDP authenticate with their own password/credentials, collected by the client. The tailnet node still joins as the signed-in user, so Headscale ACLs still gate the TCP flow — worth documenting so expections don't drift from SSH's "connects as your Headscale user" model.

Decisions needed before a plan

  • Scope: VNC, RDP, or both? Recommend VNC first — noVNC is pure JS, so it needs no new toolchain and validates the dial seam cheaply. RDP can follow.
  • Discovery: how Headplane knows a machine speaks VNC/RDP (see #3).
  • Build size: whether a second Rust WASM artifact is acceptable for the Docker image and Nix build.

Suggested phasing (once the above are settled)

  1. Export a generic dial from cmd/hp_ssh/wasm_js.go + typings, with no UI change. Add integration coverage through the existing permissions test as new routes appear.
  2. Add /vnc/:id with the SSH route's loader/lifecycle and a noVNC pane.
  3. Add /rdp/:id with IronRDP and the second WASM build target.
  4. Docs page under docs/features/, a machine menu entry gated on discovery, and a CHANGELOG.md line under # Next.

I haven't started implementation. If the scope and the discovery question can be settled, the dial seam is a well-contained first step.

Pullfrog  | Implement a fix ➔ | View workflow run | via Pullfrog | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

pullfrog[bot] avatar Oct 30 '26 08:10 pullfrog[bot]

HP-609

linear-code[bot] avatar Oct 30 '26 08:10 linear-code[bot]