Repository navigation
Closed as not planned
Closed as not planned
Copy link
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Summary
Extend OpenCode v2 pairing beyond localhost-only tunnels with a WireGuard mesh. opencode pair should print a QR code in the terminal; scanning it from a phone, tablet, or another machine joins that device to the mesh so sessions work across networks.
Problem
Pairing/tunnels currently only work on the same machine (localhost). That blocks:
- Phone as a remote control / monitor for a dev session
- Laptop ↔ desktop across different networks
- Collaboration when devices are not on the same LAN
Proposed solution
Add a WireGuard mesh under the existing session/sync protocol. Upper layers keep talking over a private mesh IP instead of localhost.
Flow
opencode pairgenerates a host WireGuard identity (keypair + peer config: endpoint, pubkey, allowed IPs, PSK).- Encode it as a pairing URI (e.g.
wg://…or a compact signed payload). - Render a QR code in the terminal (ASCII/Unicode) plus a pasteable join command.
- The other device scans / imports:
- Mobile: deep-link into WireGuard (or an OpenCode companion) and connect
- Desktop/CLI:
opencode join <uri>or import intowg-quick/ userspace WG - Browser: v1 fallback (relay / WebRTC data channel) if native WG isn’t available
- Peer gets a mesh IP (e.g.
10.88.0.2). OpenCode session/sync runs over the tunnel.
Example UX
$ opencode pair
Generating mesh identity...
Scan this QR with your device:
█▀▀▀▀▀█ ▀▄█▀▄ █▀▀▀▀▀█
█ ███ █ ▀█ ▄▀ █ ███ █
█ ▀▀▀ █ █▄▀ ▀ █ ▀▀▀ █
▀▀▀▀▀▀▀ █▄▀ █ ▀▀▀▀▀▀▀
Or: opencode join wg://eyJwdWJrZXkiOi...
Waiting for peer... (expires in 5:00)
✔ Device "iPhone-14" joined (10.88.0.2)
Requirements
- Terminal QR (no image file)
- Ephemeral keys per pairing; optional persist for a trusted-device list
- Single-use QR, short TTL (e.g. 5 min)
- NAT traversal: STUN + lightweight relay (DERP-style) when holepunching fails
- Device list + revoke (
opencode devices list/revoke <id>) - Signed pairing payload; don’t log private keys
- Fallback when kernel WG isn’t available (userspace WG, or documented relay path)
Clients
| Surface | Approach |
|---|---|
| CLI / desktop | wg-quick or embedded userspace WG (wireguard-go / similar) |
| Mobile | Deep-link official WireGuard app first; companion app later if UX needs it |
| Browser | Don’t block v1 on WASM-WG; use relay/WebRTC until native WG is realistic |
Open questions
- Own relay vs. existing DERP-like service for NAT?
- Official WireGuard app deep-link vs. a first-party mobile app for v1?
- Does “browser pairing” need to be a full mesh peer, or just a secure tunnel to the host?
- Does joining the mesh imply trust, or is there a second auth step after connect?
Metadata
Metadata
Assignees
Labels
No labels
Activity
opencode-agent commentedon Oct 26, 2026
Thanks for the detailed proposal, @suse-coder! As I understand it, you'd like
opencode pairto set up a WireGuard mesh. You'd scan a QR code from the terminal to join a phone or another machine, with NAT traversal and a relay fallback, plusopencode devices list/revoketo manage trusted devices. That way sessions would work across networks, not just on the same machine. Maintainers will consider it.Pairing isn't limited to localhost today, though:
opencode pairlists your LAN addresses, using one-time pairing codes that expire after 5 minutes.opencode pair --remote(v2.0.25 and later) exposes your server through a tunnel so another device can reach it from a different network.opencode pair --url http://<mesh-ip>:<port>puts that address in the pairing link.So the new part of this request is a built-in WireGuard mesh: NAT traversal, a relay, and a list of trusted devices you can revoke.
Related issues:
/pairQR code in the TUI uses the loopback address, so other devices can't connectneriousy commentedon Nov 12, 2026
Thanks for the suggestion. This isn't something we plan to build, so closing to keep the tracker focused.