Skip to content

🔁 Running as a service ​

tunlit start runs every tunnel from one file and reconnects on its own. tunlit service install makes it start with your session.

The file ​

~/.config/tunlit/tunnels.yml on Linux, ~/Library/Application Support/tunlit/tunnels.yml on macOS, %APPDATA%\tunlit\tunnels.yml on Windows. Each key is the tunnel name:

yaml
tunnels:
  myapp:
    http: 3000
  site:
    serve: /var/www/site
    password: hunter2
  shop:
    http: 3000
    routes:
      /api: 4000
      /docs: /var/www/docs
  db:
    tcp: 5432
    allow: [ 10.0.0.0/8 ]
    block: [ tor, vpn ]
KeyDescription
httpA port, host:port or https://host[:port].
serveA directory to serve.
tcpA port or host:port, shared with a code.
routesPrefix to port, host:port or directory, see Routing by path.
shapelatency, jitter, bandwidth, loss, see Simulating a bad connection.
keep_hostSend the public hostname as Host (HTTP only).
allow / allow_countriesOnly these addresses or countries.
block_ips / block_countriesNever these addresses or countries.
blocktor, vpn, datacenter, blocklist.
password / require_loginSign-in for visitors (HTTP only).

Names should be persistent, otherwise they are free for anyone while the service is down.

sh
tunlit start                      # foreground, Ctrl+C stops everything
tunlit start --config other.yml

Installing ​

sh
tunlit service install
tunlit service uninstall
SystemWhat it installs
Linuxsystemd user unit, journalctl --user -u tunlit -f for logs. Linger is enabled so it also runs without a login session.
macOSLaunch agent, logs in ~/Library/Logs/tunlit.log.
WindowsScheduled task that runs at logon.

The device has to be linked (tunlit login) first; the file is created with an example if it is missing.

Distributed under the MIT License