Multiple tunnels

tunl start opens more than one HTTP, TCP, and TLS tunnel in one process. Each tunnel reconnects on its own when it drops. If one hits a permanent error, that tunnel stops. The others continue.

Configuration

The default file name is tunl.yml. The key is the tunnel name. name can change that name.

server: 127.0.0.1:7000
token: bir-belirtec
tunnels:
  web:
    proto: http
    addr: 3000
    name: demo
    auth: user:password
    allow:
      - 203.0.113.4
    rate: 60
    add:
      X-From: tunl
    remove:
      - X-Internal
  sql:
    proto: tcp
    addr: 5432
    host: 127.0.0.1

Fields

FieldMeaning
serverControl address; tls://host:port for an encrypted connection. A flag and ADIT_SERVER override the file.
tokenServer token. A flag and ADIT_TOKEN override the file. If other people can read the file, do not write the token here; pass it from the environment.
fingerprintsha256:... fingerprint of a self-signed server certificate. Only with a tls:// address. A flag and ADIT_FINGERPRINT override the file.
allow_plainIf true, the agent connects to a server on another machine without tls://; the token goes over the network in the clear. Off by default. The flag --allow-plain and ADIT_ALLOW_PLAIN grant the same permission.
protohttp, tcp, or tls.
addrA port or host:port. On an HTTP tunnel, also http://host:port, https://host:port, or a file:// path.
hostLeft side of the local address when only a port was given. Default 127.0.0.1.
namePublic name. If empty, the key is used.
authPassword for the HTTP endpoint, user:password.
allowAllowed IP or CIDR. If it is not empty, anything else is 403.
denyRejected IP or CIDR. It does not pass even if it is inside allow.
rateRequests allowed per minute per client. 0 is unlimited. Over the limit is 429. A password that does not match counts too.
add / removeRequest header. HTTP only. On TCP and TLS the command says üstbilgi yalnız http.
add_response / remove_responseResponse header. HTTP only.
host_headerHost header sent upstream: rewrite or explicit host[:port]. HTTP only.
routesMap of path prefixes to upstream targets (e.g. /api: 8080, /static: file:///var/www). HTTP only.
verify_webhookgithub:secret, slack:secret, stripe:secret, or hmac-sha256:Header:secret. HTTP only. On TCP and TLS, webhook yalnız http.

Run it

tunl start
tunl start web
tunl start web sql --config tunl.yml --server 127.0.0.1:7000 --token bir-belirtec

If no name is given, every tunnel in the file opens. A name is a key in the file. A key that is not there is an error. A separate line is printed for each tunnel: the tunnel name, the public address, the local endpoint, and the panel. Requests stream in the terminal as tunnel name, method, path, status and duration. The program prints kesmek için Ctrl+C when it is ready to be stopped. A tunnel closed from the panel stops in that process and is reported as panelden kapatıldı.

Do not write a port at the end of the tunl start command. For a single tunnel, tunl http, tunl tcp, or tunl tls is used as well. Those commands also carry the --allow, --deny, --rate, --add, --remove, --response-add, --response-remove, --host-header, --route, and --verify-webhook flags. Header, routing, host-header, and webhook flags are valid only on an HTTP tunnel.