github GlassHaven/Haven v5.40.0

latest releases: v6.0.7, v6.0.6, v6.0.5...
6 months ago

v5.40.0 — Mosh through the WireGuard / Tailscale tunnel

Targeted release for #164 (Senkoi): with Haven's built-in tunnel enabled, SSH worked but Mosh's UDP packets bypassed the tunnel and never reached the server. Now Mosh rides the same tunnel as SSH.

What changed under the hood

Haven's gomobile bridges (wgbridge, tsbridge) only exposed TCP to Kotlin. gVisor netstack (wireguard-go) and tsnet both support UDP natively — that surface just wasn't bound. v5.40 adds it.

Layer Before After
Go (wgbridge / tsbridge) TunnelHandle.Dial (TCP only) + ListenUDP, UDPConn.{ReadFrom, WriteTo, Close}
Kotlin Tunnel interface dial, socksAddress + listenUdp() (default null)
TunnelResolver dial, socketFactory, socksEndpoint, socketDialer + dialUdp, + udpSocketSupplier
mosh-kotlin hardcoded DatagramSocket() UdpSocketProvider → AndroidUdpAdapter (default) or tunneled adapter
Wiring — ConnectionsViewModel.finishMoshConnect resolves a provider per profile; non-tunneled profiles fall through to the same raw socket as before
MCP — list_ssh_keys / import_ssh_key / delete_ssh_key; create_connection accepts useMosh + keyId

Backends that can't carry UDP — Cloudflare Access (WebSocket), legacy SOCKS / HTTP proxies — opt out via the default listenUdp() = null. Mosh falls through to a plain DatagramSocket for those, matching pre-#164 behaviour.

Two gotchas worth flagging

For anyone bringing up other userspace UDP transports against wireguard-go's bundled gVisor netstack:

  1. netip.AddrPort{} (zero value) as the bind → SIGABRT inside libgojni.so. The netstack leaves its NetworkProtocolNumber unset; gVisor abort()s on endpoint creation.
  2. netip.IPv4Unspecified() (0.0.0.0:0) as the bind → first WriteTo returns network is unreachable. The stack can't pick a primary IP from the NIC for the unspecified source.

Fix: bind to the tunnel's [Interface] Address from the wg-quick config (e.g. 10.0.0.2:0). Both fixes are in this release; the wgbridge.go comment block has the full story.

Verified

  • WireGuard end-to-end on a Pixel 8 Pro against a real mosh-server: handshake, throughput, persistent session.
  • Tailscale end-to-end against a tsnet node in the same tailnet: tcpdump on tailscale0 confirms steady bidirectional UDP between the Pixel and the server on the tailnet IPs, never on the default route. The whole flow was driven through the new MCP endpoints (import_ssh_key → create_tunnel → create_connection(useMosh=true, keyId=…, tunnelConfigId=…) → connect_profile) without touching the on-device UI.
  • Non-tunneled Mosh: unchanged code path, regression spot-check green.
  • Existing MoshConnectivityTest / MoshTransportTest suites green after the refactor.

What hasn't changed

The v5.39 UX work (auto-hide tabs, autoscroll velocity scaling, per-phase install retry, step-ca OIDC normalisation), the v5.38 multi-distro proot Linux installer, MCP foreground-service binding, and the rest of the MCP toolkit all carry forward unchanged.

Don't miss a new Haven release

NewReleases is sending notifications on new releases.