examples/

directory
v0.28.0 Latest Latest
Warning

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

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

README

holt examples

Each example is a single-process, runnable demo — a hub and one or more peers wired together so you can watch a reverse tunnel work.

Example Shows
echo The minimal round-trip: a peer serves an HTTP handler with no listener; the hub reaches it through the tunnel.
authenticated The identity seam: the hub derives each peer's ID from a bearer token, so the RoundTripper is keyed by an authenticated identity the handshake never carries.
client-server Two standalone binaries over a real socket — a hub that reverse-proxies your curl through a listenerless peer's tunnel. The realistic deployment shape.
transport-tls Two binaries. Outer mutual TLS on the WebSocket hop; the hub takes each peer's identity from its client certificate's CN.
encrypted Two binaries. Inner mutual TLS inside the tunnel over a plaintext transport — end-to-end confidentiality and mutual auth even past a TLS-terminating proxy.
join-token Mutual TLS with no cert files: the server prints a copy-paste join token (CA + client cert + key) you hand to the client's --token flag.

The tunnel's carrier is a WebSocket, so a peer names the hub by URL and the scheme picks the transport:

Scheme Meaning
ws:// plaintext WebSocket
wss:// TLS on the WebSocket hop (via the edge)
http:// / https:// accepted as aliases of ws / wss

To write a peer for the holt CLI specifically (JWT + tunnel URL from a join token), copy cmd/starter-client, it lives next to the CLI because it's coupled to that token format, not to the library.

Run any of them with go run ./examples/<name>.

Which TLS do I want? transport-tls (outer) for ordinary transport security; encrypted (inner) when a proxy terminates the outer hop and you still need end-to-end confidentiality or peer-cert authentication. They compose — see each README for the trade-offs.

Directories

Path Synopsis
Command authenticated shows the identity seam: the hub derives each peer's ID from a bearer token (a stand-in for a JWT claim or mTLS SAN), so the RoundTripper is keyed by an authenticated identity the peer cannot spoof (the attach upgrade carries no identity at all).
Command authenticated shows the identity seam: the hub derives each peer's ID from a bearer token (a stand-in for a JWT claim or mTLS SAN), so the RoundTripper is keyed by an authenticated identity the peer cannot spoof (the attach upgrade carries no identity at all).
Package certs is a tiny demo PKI for the separated client/server holt examples.
Package certs is a tiny demo PKI for the separated client/server holt examples.
client-server
client command
Command client is a standalone holt peer.
Command client is a standalone holt peer.
server command
Command server is a standalone holt hub.
Command server is a standalone holt hub.
Command echo is the smallest end-to-end holt demo: it stands up a hub and a peer in one process, the peer serves an HTTP handler that only it could serve, and the hub reaches that handler by dialing back THROUGH the tunnel the peer opened.
Command echo is the smallest end-to-end holt demo: it stands up a hub and a peer in one process, the peer serves an HTTP handler that only it could serve, and the hub reaches that handler by dialing back THROUGH the tunnel the peer opened.
encrypted
client command
Command client is a holt peer that dials the hub over a PLAINTEXT transport but serves its handler over MUTUAL TLS INSIDE the tunnel.
Command client is a holt peer that dials the hub over a PLAINTEXT transport but serves its handler over MUTUAL TLS INSIDE the tunnel.
server command
Command server is a holt hub whose OUTER WebSocket hop is plaintext, but which runs MUTUAL TLS INSIDE each tunnel.
Command server is a holt hub whose OUTER WebSocket hop is plaintext, but which runs MUTUAL TLS INSIDE each tunnel.
join-token
client command
Command client joins the hub using a COPY-PASTE TOKEN — no cert files, no shared filesystem.
Command client joins the hub using a COPY-PASTE TOKEN — no cert files, no shared filesystem.
server command
Command server is a mutual-TLS holt hub that hands out its client credential as a COPY-PASTE TOKEN instead of writing files.
Command server is a mutual-TLS holt hub that hands out its client credential as a COPY-PASTE TOKEN instead of writing files.
transport-tls
client command
Command client is a holt peer that dials the hub over MUTUAL TLS.
Command client is a holt peer that dials the hub over MUTUAL TLS.
server command
Command server is a holt hub that secures the OUTER WebSocket connection with MUTUAL TLS.
Command server is a holt hub that secures the OUTER WebSocket connection with MUTUAL TLS.

Jump to

Keyboard shortcuts

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