echo/

directory
v0.36.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: MIT

README

echo — minimal reverse-tunnel pair

The smallest holt deployment: a hub and a peer as two programs. The peer serves an HTTP handler and never listens; the hub reaches that handler by dialing back through the tunnel the peer opened.

  • server/ — the hub half: holt.NewServer() with zero configuration (tunnel on 127.0.0.1:7200, proxy on :7202).
  • client/ — the peer half: holt.NewClient serving /whoami back over the tunnel.

Run it

Terminal 1 — the hub:

go run ./examples/echo/server

Terminal 2 — the peer:

go run ./examples/echo/client

Terminal 3 — reach the listenerless peer through the hub's proxy:

curl -H 'x-tunnel-peer: peer' http://127.0.0.1:7202/whoami
# I am the peer; the hub reached me through the tunnel

The only inbound listeners anywhere are the hub's. That is the whole point: the peer is reachable without a port, a public address, or a hole in its firewall — curl reaches it purely because the peer dialed out and the hub proxies back down that tunnel. Kill and restart the hub: the peer redials with backoff and reappears.

No identity is configured, so the development identity applies: the peer names itself with the x-holt-peer header, nothing verifies the claim, and the tunnel refuses to bind anywhere another machine could reach.

Next: ../authenticated replaces the development identity with a real one.

Directories

Path Synopsis
Command client is the peer half of the echo example: it dials the hub and serves an HTTP handler back over the reverse tunnel, while listening on nothing itself.
Command client is the peer half of the echo example: it dials the hub and serves an HTTP handler back over the reverse tunnel, while listening on nothing itself.
Command server is the hub half of the echo example, with zero configuration: holt.NewServer() serves the tunnel on 127.0.0.1:7200 and a proxy on :7202.
Command server is the hub half of the echo example, with zero configuration: holt.NewServer() serves the tunnel on 127.0.0.1:7200 and a proxy on :7202.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL