Agent commands

tunl connects to a local port. It does not start the server. The server is on its own page.

Commands

CommandWhat it does
tunl http <port>HTTP, HTTP/2 (h2c / gRPC), and WebSocket tunnel. A flag may be written before the port or after it.
tunl tcp <port>Raw TCP tunnel (optional upstream HAProxy --proxy-proto v1|v2).
tunl tls <port>TLS passthrough. The bytes are forwarded without being cut.
tunl udp <port>UDP datagram tunnel (session NAT table, reserved UDP port support).
tunl start [name ...]Opens the tunnels in tunl.yml in one process. If names are given, only those keys open.
tunl config checkChecks the configuration without running it. config edit opens the file. Writes a sample if the file is missing. The editor is EDITOR on Windows, or Notepad if that is unset; on Linux and macOS it is VISUAL, then EDITOR, or vi if neither is set.
tunl completion powershell|bash|zshPrints a shell completion script. Subcommand, flag, the --config file, and the --account account are completed. Install is below.
tunl service installInstalls a Windows service and asks for an administrator. service uninstall removes it, service start and service stop start and stop it. --name is for more than one service on the same machine. The service account is --account system|virtual|localservice|networkservice (default system).
tunl versionPrints the version.
tunl update --urlUpdates the agent from the panel's server. A server on another machine needs https://; detail below.

http, tcp, and tls flags

FlagEnvironmentDefaultMeaning
--serverADIT_SERVER127.0.0.1:7000Control address. If the server was started with --control-tls, tls://host:port
--fingerprintADIT_FINGERPRINTemptysha256:... fingerprint of a self-signed server certificate. Only with a tls:// address
--allow-plainADIT_ALLOW_PLAINoffAllows a connection to a server on another machine without tls://; the token goes over the network in the clear. Without it, the agent does not make that connection. Not required for 127.0.0.1, localhost, and ::1
--nameemptyReserved name. Empty means a temporary name
--tokenADIT_TOKENemptyServer token
--authemptyuser:password
--host127.0.0.1Left side of the local address when only a port is given
--allowemptyAllowed IP or CIDR. Repeatable. A comma splits too
--rate0Requests per minute per client. 0 is unlimited
--addemptyRequest header Name:value. HTTP only
--removeemptyRequest header to delete. HTTP only
--denyemptyRejected IP or CIDR. Repeatable. Does not pass even if it is inside allow
--response-addemptyResponse header Name:value. HTTP only
--response-removeemptyResponse header to delete. HTTP only
--verify-webhookemptygithub:secret, slack:secret, stripe:secret, or hmac-sha256:Header:secret. HTTP only
--host-headeremptyHost header sent to the local app: rewrite (use upstream address) or explicit host[:port]. HTTP only
--routeemptyPath-prefix routing /prefix=target (port, host:port, https://, or file://). Repeatable. HTTP only
--domainemptyBind verified custom hostname(s) to this tunnel. Repeatable
--pooloffAllow multiple agents to share the same --name endpoint pool
--lbround-robinPool load-balancing strategy: round-robin, least-conn, ip-hash, or failover
--weight1Replica weight (1..100) for weighted round-robin
--drain-timeout5sGraceful drain window on Ctrl+C / SIGTERM before closing in-flight streams
--proxy-protoemptyPrepend HAProxy PROXY protocol header (v1 or v2) to local TCP/TLS upstream connections
--http2offForce end-to-end HTTP/2 (h2c / ALPN h2) for HTTP and gRPC upstreams
--api-keyemptyRequire constant-time edge API key (secret or Header:secret); stripped before upstream. Repeatable
--jwt-secret / --jwt-jwks-urlemptyVerify Bearer JWT at the edge via HMAC secret or SSRF-guarded HTTPS JWKS (RS*, ES*, EdDSA); pair with --jwt-iss / --jwt-aud
--oauthemptyEdge OIDC/OAuth2 PKCE login (oidc, google, github); pair with --oauth-allow-email / --oauth-allow-domain
--corsemptyEdge CORS policy (* or comma-separated origins; answers OPTIONS preflight with 204)
--max-body0Maximum request body size (e.g. 10m, 512k); oversize requests receive 413
--mockemptyAnswer directly at the edge without dialing upstream (e.g. 200:{"ok":true})
--wafoffLinear-time edge WAF blocking path traversal, sensitive dotfiles, SQLi, XSS, and Log4Shell
--event-webhookemptyHTTPS webhook notified on tunnel up/down, pool failover, and quota events
--inspect127.0.0.1:4040Local inspector. off turns it off

The target may be a port, http://host:port, https://host:port, or a file:// path. http:// translates to plain TCP. On an HTTPS upstream the certificate is not verified; that is for a development certificate. A file target serves that folder over HTTP. A TCP or TLS tunnel accepts only host:port.

While a tunnel is open, each request is one line in the terminal: tunnel name, method, path, status, and duration. The panel record is separate. By default the agent serves recent requests at 127.0.0.1:4040. If you start a second agent on the same machine, that port is taken; the agent takes the first free port from 4041 through 4050 and prints the address. An address you set with --inspect is not moved; if it is busy, the agent stops and says denetçi açılamadı. The browser opens the page. /api/requests returns the record list, and /api/tunnels returns the open tunnels. When the same tunnel reconnects, it appears once in the list. Turn it off with --inspect off. While the inspector listens on a loopback address, it answers only requests whose Host is localhost or a loopback IP (such as 127.0.0.1 or ::1); another Host gets 403. That stops a site from pointing its own name at 127.0.0.1 and reading the inspector from your browser (DNS rebinding). If you bound the inspector to a non-loopback address with --inspect, this check is not done.

Other commands

tunl tls 4430
tunl http 3000 --route /api=8080 --route /static=file:///var/www --host-header rewrite
tunl http 3000 --deny 203.0.113.8 --response-add X-Out:tunl --verify-webhook hmac-sha256:X-Signature:secret
tunl config check
tunl completion powershell
tunl service install --config tunl.yml

tls forwards the bytes without cutting them (on both a dedicated port and the shared HTTPS port via SNI). --route splits one HTTP tunnel across multiple local services or folders by longest path prefix. --host-header rewrite rewrites the Host header to each matched upstream's address while preserving X-Forwarded-Host. --deny turns away the addresses on the list. --response-add and --response-remove change a response header. --verify-webhook cuts a request whose GitHub, Slack, Stripe, or generic HMAC-SHA256 signature does not match, with 403. config check checks the file without running it and reports whether the connection is encrypted. service install installs a Windows service and asks for an administrator; the service runs tunl start --config, and its output goes to tunl-service.log next to the configuration file. The service runs as LocalSystem by default; --account virtual uses an unprivileged account that belongs to that service and grants write permission on the configuration folder. If the configuration is in your user folder (C:\Users\you), that account cannot read it; the install warns, so move the file somewhere like C:\ProgramData\tunl.surf.

tunl http 3000
tunl http 3000 --name demo --server 127.0.0.1:7000
tunl http 8080 --auth user:password
tunl tcp 5432

start flags

FlagDefaultMeaning
--configtunl.ymlConfiguration file
--serverfrom the fileReplaces the file's control address
--tokenfrom the fileReplaces the file's token
--fingerprintfrom the fileReplaces the file's fingerprint field
--inspect127.0.0.1:4040Local inspector. off turns it off

ADIT_SERVER, ADIT_TOKEN, and ADIT_FINGERPRINT also override the file. ADIT_ALLOW_PLAIN or --allow-plain allows a clear connection the way allow_plain: true in the file does; none of them takes the permission back. tunl config check reports whether the agent will connect to this server. Names are keys in the file: tunl start web opens only that tunnel. Flags may also be written after the names: tunl start web --config tunl.yml. tunl start --inspect off turns the local inspector off. This command does not take a port. If the token sits in the file and (on Linux and macOS) other users can read the file, the agent says so; run chmod 600 tunl.yml, or put the token in ADIT_TOKEN instead of the file. On Windows the permission bits mean nothing, so this warning is not printed.

Shell completion

ShellRun onceAdd to the startup file
PowerShell$PROFILE: tunl completion powershell | Out-String | Invoke-Expression
bashtunl completion bash > ~/.tunl-completion.bash~/.bashrc (on macOS, ~/.bash_profile): . ~/.tunl-completion.bash
zshmkdir -p ~/.zfunc && tunl completion zsh > ~/.zfunc/_tunl~/.zshrc: fpath=(~/.zfunc $fpath), then autoload -Uz compinit && compinit

In zsh the fpath line must come before the compinit line. If you source the script before compinit is loaded, it tells you what to do and does not install completion. A file whose name contains a space comes back quoted in PowerShell and escaped in bash and zsh; that includes the bash 3.2 that ships with macOS. A flag is not suggested after a flag that expects a value. Windows PowerShell does not consult completion at all while only -- is being typed; type tunl http and press Tab and every flag is listed.

update

tunl update --url http://127.0.0.1:4590

If --url is not given, ADIT_URL is used, or http://127.0.0.1:4590 if that is unset too.

The downloaded program runs with the privileges of the person who updates (system privileges if the service is LocalSystem). The checksum comes from the same server as the program, so it only shows that the file was not corrupted; it is not a signature. Over clear http://, someone on the network can change both together. Because of that: