Skip to main content

tuna-tiny

tuna-tiny is a tunnel client of about 2 MB. It runs a single HTTP or TCP tunnel and does nothing else. It is meant for OpenWrt and MikroTik routers, embedded devices, FROM scratch containers and CI.

Linux only

There are builds for every Linux architecture Go supports: amd64, 386, arm64, armv5, armv6, armv7, mips, mipsle, mips64, mips64le, riscv64, loong64, ppc64, ppc64le, s390x. See What is not supported for the limits. For Windows, macOS and FreeBSD, use tuna-cli.

How it differs from tuna-cli​

tuna-tiny is built on the Go SDK and does one thing: keeps a tunnel up, reconnecting after a dropped connection and keeping the address. Everything else is only in the full tuna-cli:

  • Tunnels: middleware (password, headers, IP filtering for HTTP, webhook signature verification), traffic inspector, file server, WebDAV, HTTPS applications, a config file with several tunnels.
  • Services: tunnels as system services with tuna service.
  • Sign-in: through the browser with tuna login. tuna-tiny works only with an API key.
  • Platform: secrets, monitors, mesh, domains and the rest of Tuna.

Authentication​

tuna-tiny accepts only an API key with the tunnels:connect permission: the "For tunnels" preset or "Launch tunnels". Pass the key in the TUNA_API_KEY variable or with the --api-key flag. The variable is safer, since the flag shows up in ps. More on keys in Sessions and API keys.

Installation​

Download the binary for your architecture and make it executable:

curl -fLo tuna-tiny https://releases.tuna.am/tuna-tiny/latest/tuna-tiny_linux_amd64
chmod +x tuna-tiny

Builds: amd64, 386, arm64, armv5, armv6, armv7, mips, mipsle, mips64, mips64le, riscv64, loong64, ppc64, ppc64le, s390x. The URL is https://releases.tuna.am/tuna-tiny/latest/tuna-tiny_linux_<build>. The armv5 build runs on any 32-bit ARM.

The binary is static and depends on neither system libraries nor system root certificates. For Windows, macOS and FreeBSD, use tuna-cli.

Usage​

Permanent address

Without a reserved subdomain (-s, subdomain in UCI) or port (-p, port), the tunnel address changes after every restart of tuna-tiny or the router. For routers and unattended devices, reserve the address.

tuna-tiny http <addr> [--api-key KEY] [-s SUBDOMAIN] [-d DOMAIN] [--log-format text|json]
tuna-tiny tcp <addr> [--api-key KEY] [-p PORT] [--proxy-protocol 1|2]
[--cidr-allow CIDR]... [--cidr-deny CIDR]...
[--log-format text|json]
tuna-tiny version

addr is the local address: 8080, 10.0.0.1:8080, http://localhost:8080 or unix:///path/to.sock.

FlagVariableMeaning
--api-keyTUNA_API_KEYAPI key with the tunnels:connect permission
-sTUNA_SUBDOMAINHTTP: reserved subdomain
-dTUNA_DOMAINHTTP: custom domain
-pTUNA_TCP_PORTTCP: reserved port or its alias
--proxy-protocolTUNA_PROXY_PROTOCOLTCP: PROXY protocol version, 1 or 2
--cidr-allowTUNA_CIDR_ALLOWTCP: allow only these subnets; the flag can be repeated, the variable takes a comma-separated list
--cidr-denyTUNA_CIDR_DENYTCP: reject these subnets
--log-formatTUNA_LOG_FORMATtext (default) or json

The variable names are the same as in tuna-cli. A flag takes precedence over its variable.

Subnets are checked by the Tuna node, not by tuna-tiny, so unwanted connections never reach the device. That is why tuna-tiny has --cidr-allow even though it has no middleware.

Web interface over HTTP​

export TUNA_API_KEY=tak_xxx
tuna-tiny http 80 -s my-router

tuna-tiny prints a public address such as https://my-router.ru.tuna.am, which opens the router's web interface. The my-router subdomain has to be reserved; without -s the address is dynamic.

warning

An HTTP tunnel in tuna-tiny cannot be protected with a password yet: it has no middleware. Publish only services with their own authentication, and if you need a password or IP filtering, use tuna-cli.

SSH over TCP​

tuna-tiny tcp 22 --cidr-allow 203.0.113.0/24

SSH will be reachable only from the 203.0.113.0/24 network.

JSON logs​

With --log-format json, tuna-tiny writes one JSON line per event to stdout. This is easier to parse for wrappers and log collectors.

{"time":"2026-12-01T10:00:00Z","event":"connected","url":"https://my-router.ru.tuna.am"}

The event field is one of connected, reconnecting, reconnected, banner, session_expiring, terminated, local_error, error. Depending on the event, the line also has url, message, reason, error, retry_in and expires_in (in seconds).

Behavior​

  • After a dropped connection, tuna-tiny reconnects and keeps the public address. The pause between attempts is 1 to 15 s.
  • After a process or router restart, the address changes unless it is reserved: the tunnel session lives only in the process memory.
  • tuna-tiny retries temporary server errors on its own. It exits with code 1 only on permanent ones: a wrong or revoked key, a deleted tunnel, a plan limit.
  • The Host header and the PROXY protocol header reach the service unchanged.
  • API requests go through HTTPS_PROXY if it is set. Connections to Tuna nodes are direct.
  • On startup, tuna-tiny logs a message with a link to this page if a new version is out. The message comes once, on the first connection: a tuna-tiny that has been running for months learns about the new version only after a restart. It does not update itself: update the package or the binary.
  • On startup, tuna-tiny sends anonymous usage statistics, just like tuna-cli: OS, architecture, version, command and flag names without values.

Memory​

tuna-tiny uses 12–14 MB of RAM. About 5 MB of that is unpacked code, since the binary is compressed with UPX. On devices with 32 MB of RAM this is noticeable. If memory is short, set the Go runtime variables GOMEMLIMIT and GOGC: memory use goes down at the cost of CPU load.

What is not supported​

  • 32-bit PowerPC (OpenWrt mpc85xx, apm821xx) and 64-bit PowerPC before POWER8 (OpenWrt qoriq);
  • big-endian ARM (armeb, old ixp4xx) and ARM OABI;
  • ARC, Xtensa, SPARC, m68k, SuperH, Tilera (MikroTik CCR1xxx);
  • MIPS before MIPS32r1, IBM Z before z196;
  • Linux kernels before 3.2, or before 5.19 for loong64.

These are Go compiler limitations: it does not build for these platforms.