starter-client

command
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

starter-client — a peer you can copy

The smallest useful holt peer: it joins a hub with a token from holt enroll, serves one HTTP handler over the tunnel, and listens on nothing. Copy main.go and replace the handler with your own service — it has no dependency on the holt CLI's internals (the join token is decoded inline).

# on the hub machine
holt hub &
holt enroll myservice --tunnel-addr 127.0.0.1:7000   # prints a token

# anywhere (paste the token)
go run ./cmd/starter-client --token eyJ...

# reach it through the hub
curl -H 'x-tunnel-peer: myservice' http://localhost:7002/
#   hello from myservice — you reached / through the tunnel

The four steps every peer does

main.go is organised around them:

  1. Pin the hub cert from the token → TLS that encrypts the tunnel and authenticates the hub.
  2. Dial the hub with a bearer-JWT interceptor → the hub authenticates the peer.
  3. Build your handler — the one thing you customise.
  4. dial.Run — attach and serve, redialing automatically.

That's the whole client. Everything else (the CLI, TLS files, SQLite, the admin API) is the hub's concern.

Documentation

Overview

Command starter-client is a minimal, self-contained holt peer — a template to copy when writing your own client. It joins a hub with a token from `holt enroll`, serves one HTTP handler over the tunnel, and listens on nothing.

Everything a peer needs is here and nothing else: decode the token, dial the hub (TLS pinned + JWT), and dial.Run your handler. The join token is decoded inline (a tiny base64+JSON struct) so this file has no dependency on the holt CLI's internals — copy it and go.

# on the hub machine:
holt hub &
holt enroll myservice        # prints a token

# anywhere:
go run ./cmd/starter-client --token <paste>

# reach it through the hub:
curl -H 'x-tunnel-peer: myservice' http://localhost:7002/

Jump to

Keyboard shortcuts

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