Local setup
Start a local relay and connector on loopback and verify end-to-end certificate pinning with the bundled echo service. Assumes vagus is installed on PATH (see Install).
Generate local credentials
vagus bootstrap -dir DIR creates a new directory (which must not exist yet) with a connector identity key and a local self-signed relay certificate, and prints the route ID:
state="$(mktemp -d)"
id=$(vagus bootstrap -dir "$state/local")
printf 'Route ID: %s\n' "$id"
Do not use bootstrap certificates in production. To keep the same route ID across local restarts, pass a persistent path like $HOME/.local/share/vagus-dev once and reuse it. When connecting to an existing relay, create just an identity key with vagus keygen -out ./endpoint.pem.
Start relay, connector, and echo service
Start the relay and connector on loopback:
vagus relay \
-public 127.0.0.1:19452 \
-control 127.0.0.1:19451 \
-https 127.0.0.1:19453 \
-domain relay.test \
-cert "$state/local/control.pem" \
-key "$state/local/control.key" &
relay_pid=$!
vagus connect \
-relay 127.0.0.1:19451 \
-ca "$state/local/control.pem" \
-identity "$state/local/endpoint.pem" \
-backend 127.0.0.1:4443 \
-leaf-dir "$state/local/leaves" &
connector_pid=$!
Once connected, vagus connect prints admitted <route-id> to stderr and writes the active leaf certificate and key into $state/local/leaves.
From a repository checkout (Go 1.27+), start the bundled quic-echo service:
go run ./examples/quic-echo serve -listen 127.0.0.1:4443 -leaf-dir "$state/local/leaves" &
echo_pid=$!
Test the connection
Dial the echo service through the relay:
go run ./examples/quic-echo dial -via 127.0.0.1:19452 -name "$id.relay.test" hello
The command prints hello after verifying that the echo service's leaf certificate was signed by the key matching $id.
Attach your own service
Stop quic-echo (kill "$echo_pid"), listen on UDP 127.0.0.1:4443, and configure your service to serve $state/local/leaves/cert.pem and $state/local/leaves/key.pem (reloading when cert.pem changes). Do not configure clients to trust control.pem for application traffic, since it authenticates only the relay.
- Go clients use
pintls.ClientConfig(id, cfg)fromneuroplast.io/vagus/pkg/pin/pintlsand dial UDP127.0.0.1:19452with SNI<id>.relay.test. - For browser clients on loopback, see Browser client or run examples/chat.
- For
-mode datagramframing, systemd units, and CLI options, see Operations.
Clean up
kill "$echo_pid" "$connector_pid" "$relay_pid" 2>/dev/null || true
rm -rf -- "$state"
Troubleshooting
| Symptom | What to check |
|---|---|
file exists from vagus bootstrap -dir |
The target directory must not exist yet. Pass a new subdirectory such as "$state/local". |
| Client times out during QUIC handshake | Confirm vagus connect printed admitted <route-id>, the client sends SNI <route-id>.relay.test (matching -domain) over QUIC v1 or v2 without ECH, and the backend listens on the exact -backend UDP address. |
| TLS certificate error in the client | Check the service's leaf certificate or pinned hash, not control.pem. |