Skip to main content

tuna-tiny and SDKs for eight languages — a tunnel on your router and right from your code

· 5 min

tuna CLI does a lot: middleware, the inspector, secrets, monitors, mesh. But its binary is about 25 MB, and a router with 16 MB of flash has no room for it. Often all you need from a client is one thing: keep a tunnel open to the router's web interface, to SSH, or to a service in a container.

That's why we released tuna-tiny, a 2 MB tunnel client. And to open a tunnel right from your application, we released SDKs for eight languages: Go, Node.js, Python, Java, .NET, PHP, Ruby, and Rust.

In brief
  • tuna-tiny — a single HTTP or TCP tunnel, with a binary and image of about 2 MB. There are packages for Alpine and OpenWrt and a container for MikroTik. Documentation.
  • SDKs — a tunnel from Go, Node.js, Python, Java, .NET, PHP, Ruby, or Rust code: accept connections yourself or forward them to a local address. Documentation.

tuna-tiny​

tuna-tiny does one thing: it keeps a tunnel up. When the connection drops, it reconnects and keeps the address. The binary is static, with root certificates built in, and needs no system libraries. The amd64 build is 2.1 MB, the mipsle build is 1.9 MB, and the Docker image is built FROM scratch and is the same size.

Where it fits:

  • OpenWrt routers. Access LuCI or the router's SSH without a public IP. The package installs a procd service and a UCI config.
  • MikroTik on RouterOS 7. tuna-tiny runs in a RouterOS container on arm, arm64, and x86, including CHR.
  • Alpine and embedded Linux. A package with an OpenRC service, and builds for 15 Linux architectures, from mips and armv5 to riscv64 and s390x.
  • Containers and CI. A 2 MB image instead of the 13 MB tuna CLI image.

Version 0.2.0 adds builds for macOS, Windows, FreeBSD, and OpenBSD on amd64 and arm64. The macOS builds are signed and notarized.

How it differs from tuna CLI​

tuna-tiny has no middleware (password, headers, IP filter for HTTP), no inspector, no file server, no config file with multiple tunnels, no services, and no browser login. It authenticates only with an API key with Run tunnels enabled (the For tunnels preset). The subnet filter for TCP (--cidr-allow, --cidr-deny) is there: the Tuna node checks subnets, so unwanted connections never reach the device.

warning

An HTTP tunnel in tuna-tiny can't be protected with a password. Only publish services that have their own authentication.

How to install​

Linux binary:

curl -fLo tuna-tiny https://releases.tuna.am/tuna-tiny/latest/tuna-tiny_linux_amd64
chmod +x tuna-tiny
TUNA_API_KEY=tak_xxx ./tuna-tiny http 8080

Docker:

docker run -d --name tuna --restart unless-stopped --network host \
-e TUNA_API_KEY=<your_key> yuccastream/tuna-tiny http 3000

OpenWrt 25.12 and later — from the repository, with updates through apk upgrade:

K=tuna@fd6ba1797a0fb356fb4aa79dbbc8ce2a43346700b64e9f20be2d759e2724549c.rsa.pub
wget -O /etc/apk/keys/$K https://code.tuna.am/api/packages/tuna/alpine/key
echo https://code.tuna.am/api/packages/tuna/alpine/openwrt/main > /etc/apk/repositories.d/tuna.list
apk update && apk add tuna-tiny

The /etc/config/tuna-tiny config already contains disabled tunnels to the router's LuCI and SSH. To open LuCI, set the key and enable the tunnel:

uci set tuna-tiny.main.api_key=tak_xxx
uci set tuna-tiny.luci.enabled=1
uci commit tuna-tiny
/etc/init.d/tuna-tiny enable
/etc/init.d/tuna-tiny start

The package for OpenWrt 24.10 and earlier, Alpine, MikroTik, and the architecture table are in the tuna-tiny documentation.

Permanent address

Without a reserved subdomain or port, the tunnel address changes every time the router reboots. For devices that run unattended, reserve an address and pass it with -s or -p.

SDKs​

An SDK opens a tunnel right from your application without installing tuna: the tunnel lives in your process and, after a dropped connection, reconnects with the same address. The API is the same in every language, and so is the key: an API key with Run tunnels enabled, passed in TUNA_API_KEY.

LanguageInstallation
Gogo get github.com/yuccastream/tuna-sdk-go
Node.jsnpm install @tuna-am/sdk
Pythonpip install tuna-sdk
Javaam.tuna:tuna-sdk
.NETTuna.Sdk
PHPcomposer require yuccastream/tuna-sdk-php
Rubygem install tuna-sdk
Rustcargo add tuna-sdk

The Java and .NET packages will reach Maven Central and nuget.org a little later. Until then, install them from the code.tuna.am registry; the Java and .NET pages show how. The PHP SDK wraps tuna-tiny: it downloads the binary and verifies its checksum on its own.

The SDKs are handy for showing a demo straight from your application, receiving webhooks in an embedded agent, or giving access to a device that runs your code. Examples, options, and events are in the SDK documentation. The package APIs may still change before v1.

No SDK for your language? Let us know in our Telegram chat. Until it exists, you can run tuna-tiny as a separate process and read its events with --log-format json.

Leave feedback​

If you enjoy using Tuna, or on the contrary you are not happy with something, please leave feedback.

News​

We announce new features and posts on our Telegram channel. Subscribe so you don't miss anything.

Help​

We value our users and carefully review every request. If you have any problems with tuna, please contact us in one of the following ways: