๐ How it works
Request flow
Every request you make to the public URL travels through this path:
Browser โ โผ HTTPS rustunnel-server (your VPS) โ WebSocket + TLS โผ yamux stream rustunnel client (your laptop / dev machine) โ plain TCP โผ this demo server :3000
Two WebSocket connections
The client maintains two persistent connections to the server:
Control plane
JSON frames
auth ยท registration ยท heartbeat
auth ยท registration ยท heartbeat
Data plane
Binary yamux
all proxied connections multiplexed
all proxied connections multiplexed
Protocol frames
Key control frames exchanged at startup:
| Frame | Direction | Purpose |
|---|---|---|
| Auth | โ server | Send token + client version |
| AuthOk | โ server | Receive session_id |
| RegisterTunnel | โ server | Request subdomain / port |
| TunnelRegistered | โ server | Receive public URL |
| NewConnection | โ server | Incoming request notification |
| Ping / Pong | โ | Heartbeat (every 30 s) |
Reconnection
If the connection drops, the client reconnects automatically with exponential backoff: 1 s โ 2 s โ 4 s โฆ 60 s with ยฑ20% jitter. Auth errors are the only fatal case โ everything else retries.