Client configuration
Startup settings control the connection and identity. Set targets, local visitor ports, and grants in the console. Console
Startup YAML
Add a direct client in the console and extract its certificate ZIP into cert/. Save the following as client.yml. Set the client key from the console through TUNNEL_CLIENT_KEY or client_key. Add a client
endpoint: tls://api.tunnel.example.com:9651
web_endpoint: https://api.tunnel.example.com:9650
certificate: cert/client.pem
certificate_key: cert/client.key
tunnel_ca: cert/tunnel-ca.pemFor native enrollment with a private key generated on the client, set root: cert/root.pem and omit the three ZIP PEM fields. Distribute the public root through a trusted channel.
client --config client.yml verify
client --config client.yml runverify checks the certificates and settings offline. On its first run, the client obtains a transport token over direct HTTP/3 on the gateway and stores its identity in the data directory. Give each instance its own data directory.
| Command | Purpose |
|---|---|
client --config client.yml status | Show the local process and control connection status. |
client --config client.yml reload | Reload the running process configuration. A successful switch closes existing application connections. |
client --config client.yml stop | Stop the process and free local resources. |
Direct connections switch only after the candidate control connection succeeds. If that attempt fails, the old connection stays active. Reloading into MQTT mode closes the old connection before connecting to the broker with the new settings. The broker allows one active connection per MQTT client ID. Restart after changing the data directory, certificate chain, or logging. Client commands
File format and precedence
The client checks app.yml first, then client.yml. Use --config to select a YAML or TOML file. Command-line options take precedence over the environment, configuration file, and defaults, in that order. Configuration file rules
Connection and client identity
| Key | Purpose |
|---|---|
endpoint | Control address. Supports tls://, tcp://, wss://, and ws://. The tcp:// alias uses TLS and ws:// uses inner TLS. |
web_endpoint | Gateway HTTPS origin for device enrollment and token retrieval over direct HTTP/3. Use a host covered by the gateway certificate, for example https://api.tunnel.example.com:9650. The implicit port is 9650/UDP. You can also set it with --web-endpoint or TUNNEL_CLIENT_WEB_ENDPOINT. Management listener |
certificate, certificate_key, tunnel_ca | client.pem, client.key, and tunnel-ca.pem from the ZIP. Restrict access to the private key. |
root | Public ML-DSA-87 root certificate for initial native enrollment. Set --root or TUNNEL_CLIENT_ROOT. Use the PEM deployment fields for MQTT. |
web_ca | Optional CA PEM file used to verify the gateway certificate. When set, this file determines trust for enrollment. Otherwise, root enrollment uses root to verify the gateway. A pre-issued ZIP uses its tunnel-ca.pem on first launch. Later, the client trusts both its stored Tunnel CA and the certificate at the configured tunnel_ca path. You can also set TUNNEL_CLIENT_WEB_CA. Tunnel CA rotation |
data_path | Stores the client's runtime identity. Defaults to data/ next to the executable. |
log_path | Log directory. Defaults to logs/ next to the data directory. |
Use only the scheme, hostname, and port for device endpoints. When connecting directly to the gateway, the host in endpoint should match the server's host and its gateway certificate. WSS defaults to port 443. Configuration keys
When the two identity methods are both configured, a ZIP PEM field at the same or higher precedence selects ZIP deployment. Set one complete method per deployment.
Upstream proxy rules
Use upstream_proxy for HTTP CONNECT or SOCKS5. Use upstream_proxy_file if the proxy requires authentication. Set use_environment_proxy: true to read environment proxies. With environment proxies, put the gateway enrollment address in no_proxy or NO_PROXY, for example NO_PROXY=api.tunnel.example.com:9650. Device enrollment requires a direct UDP connection. If you use an explicitly configured upstream proxy, switch to an environment proxy with a bypass rule. Use WSS for work relays through a proxy. QUIC and KCP use direct connections.
Provider work relay options
| Key | Purpose |
|---|---|
relay_endpoint | Default work relay address. Use tls://, wss://, ws://, quic://, or kcp://. |
relay_endpoints | One address per extra protocol. Set TUNNEL_CLIENT_RELAY_ENDPOINTS as a comma-separated list or repeat --relay-alternate-endpoint. |
relay_pool_size | Default 0, range 0–8. The pool preconnects to the default relay. |
relay_multiplex, relay_compression | Both are disabled by default and require a primary relay. |
With work relay settings omitted, the client prefers KCP on the control host at 9654/UDP. If KCP is unavailable and the relay on 9652/TCP authenticates successfully, the client selects that relay automatically. A configured primary relay supplies the host for the automatic KCP address. An explicit KCP address takes precedence. KCP requires direct UDP access. Mappings can select a relay protocol supported by the provider. Tuning options
MQTT access
Register the client with MQTT access and bind a relay and authentication mode. Extract the full ZIP and start with its app.yml. Keep the relative paths to the broker CA, credential files, and optional broker client certificate and key. mqtt-topics.txt lists broker topics. MQTT carries control and work streams. Server MQTT settings
Supply a dedicated ML-DSA-87 CA for the broker. The broker must support TLS 1.3, ML-DSA-87 certificate authentication, pure MLKEM1024, and TLS_AES_256_GCM_SHA384. When the broker requires client authentication, provide the ML-DSA-87 certificate and private key together. The inner MQTT tunnel uses the device certificate and Tunnel CA from the ZIP.
After rotating the Tunnel CA, replace the client's tunnel-ca.pem with the current public issuer.pem from the server. Reload or restart the client. Keep the client certificate, private key, and data directory. MQTT example
Process environment variables
| Variable | Purpose |
|---|---|
TUNNEL_OIDC_CLIENT_FILE, TUNNEL_OIDC_TOKEN_FILE | OAuth client configuration or short-lived access-token file for runtime authentication. |
TUNNEL_XTCP_PREWARM | Set to 1 to open XTCP paths after the grant takes effect. |
TUNNEL_P2P_STUN_SERVER | Up to four additional STUN addresses for XTCP. Separate host:port entries with commas. |
TUNNEL_P2P_ASSISTED_ADDRESS | Use the specified local IP as an XTCP candidate when approved by the server. |
TUNNEL_LOG_LEVEL | Logging level. |
TUNNEL_DATA_PATH, TUNNEL_LOG_PATH | Data and log directories. Directory settings |