Tailscale Funnel has been the flaky one here: the public *.ts.net path goes
dead while every local tailscale check stays green, and it takes the advertised
URL down with it. ngrok has never done that. But `publicUrl` — one string,
outranking ngrok by construction — left no way to lean on ngrok without
deleting the Funnel URL, and no place to park a third tunnel while trying it
out.
So tunnels become a group, one entry each with its own `enabled` flag:
"tunnels": {
"prefer": ["ngrok", "tailscale", "external"],
"ngrok": { "enabled": false, "domain": ..., "binary": ..., "apiUrl": ... },
"tailscale": { "enabled": false, "url": "" },
"external": { "enabled": false, "url": "" }
}
`prefer` is precedence, not exclusivity. Every enabled tunnel still reaches the
server; the first one that can name a URL is merely what gets baked into
bookmarks, the pairing QR and /api/config. Swapping the advertised route is a
reorder of that list plus a restart, with the losing tunnel left configured and
live as a spare. `external` is the slot for whatever comes next — Cloudflare, a
reverse proxy — without another schema change. A partial `prefer` ranks the
rest last rather than hiding them; an unknown name in it is a load error, since
a typo there would otherwise silently re-point the advertised URL.
Only ngrok is supervised, as before: `tailscale` and `external` are URLs airc
advertises for tunnels somebody else keeps up, which is all `publicUrl` ever
was. Because a reserved ngrok domain is knowable before the agent is up, it is
now advertised from the first request instead of after the agent reports; the
live URL replaces it when it lands (the two differ only without a reserved
domain), and both paths log through one announce().
`--no-ngrok` now means only what it says — skip the agent, let the next tunnel
down the list take over. `--no-tunnels` is new and means LAN/loopback only;
`tools/airc local` and `npm run dev` use it, which is what keeps local mode
preferring a LAN URL in pairing payloads now that disabling ngrok no longer
implies disabling everything. /healthz and /api/status gained a `tunnels` block
listing the routes in preference order with the advertised one named, and
`tools/airc status` prints that name next to the URL.
Old configs load untouched: a top-level `ngrok` block becomes `tunnels.ngrok`,
a top-level `publicUrl` becomes `tunnels.external.url`, and a file still in
that shape keeps its old precedence — publicUrl over ngrok — so pulling this
cannot silently re-point an existing pairing at a different tunnel. Only a
config that opts into `tunnels` gets the new ngrok-first default.
test/tunnels.test.js covers the ordering, both migration paths and the two
flags. Checked live against both orderings on a scratch port before restarting
the real server; with ngrok advertised, both it and the still-enabled Funnel
answer 200. Worth naming the cost: ngrok's free-tier interstitial does not
render in the Tesla browser, so the car keeps its ts.net bookmark, which works
precisely because a demoted tunnel stays up.
14 KiB
Installation
This covers everything beyond the Quick Start: full prerequisites, public access with ngrok, and building the optional Android app. For day-to-day running and troubleshooting, see docs/operations.md.
Contents
- Prerequisites
- Server setup
- Public access with an external tunnel
- Public access with ngrok
- LAN and tunnel at the same time
- Installing the Android app
- Zsh completions
Prerequisites
For the server (the only thing you strictly need):
- Node.js ≥ 20
- tmux
- A POSIX shell. Developed on Linux; macOS should work.
Optional, depending on how far you take it:
- ngrok — only for public/away-from-home access.
- Android SDK + JDK 17 — only if you want to build the Android app yourself; a prebuilt APK is on the releases page.
Server setup
git clone https://github.com/Kynde/airc.git
cd airc
npm install
The only runtime dependency is qrcode-terminal (for printing pairing QR codes).
You do not need to create config.json by hand. On first run Airc writes one
for you with strong, randomly generated viewToken and controlToken values and
locks it to 0600. If you'd rather start from a template:
cp config.example.json config.json
Leave viewToken/controlToken empty and Airc fills them in; set them yourself
only if you want specific values (they must be ≥ 32 chars or Airc warns).
Then start it on your LAN and pair a browser:
tmux new -s main
tools/airc local
tools/airc pair-web
tools/airc local is shorthand for starting the server with --host 0.0.0.0 --no-tunnels, i.e. reachable on your LAN with no tunnel. See
docs/operations.md for the rest of the runtime commands.
config.json keys worth knowing
| Key | Default | Meaning |
|---|---|---|
host |
127.0.0.1 |
Bind address. 0.0.0.0 exposes it on the LAN (what local sets). |
port |
8080 |
HTTP port (browsers). |
sessions |
["*"] |
tmux session name(s) to follow; supports */? globs. The default follows every live session; set it only to narrow the scope. |
viewToken / controlToken |
auto-generated | View-only vs. can-type tokens. |
theme |
dark |
Initial browser theme. |
tls.enabled |
true |
Serve HTTPS for the app alongside HTTP — see App over HTTPS. |
tls.port |
8443 |
HTTPS port the Android app connects to. |
dais.enabled |
false |
Show the voice-dictation mic button (docs/dais.md). Off by default because with it on, the control token can also open the laptop's microphone. |
dais.socket |
"" |
Path to the dais control socket; empty means $XDG_RUNTIME_DIR/dais/control.sock. Must be absolute. |
tunnels.prefer |
["ngrok", "tailscale", "external"] |
Which tunnel gets advertised, best first. Enabling several is fine — they all keep working; this only picks the one that goes into bookmarks and the pairing QR. |
tunnels.ngrok.enabled |
false |
Start and supervise an ngrok agent? Off by default — see below. |
tunnels.ngrok.domain |
placeholder | Your reserved ngrok domain. |
tunnels.tailscale.enabled / .url |
false / "" |
A Tailscale Funnel you brought up. Airc doesn't start it — it just advertises the URL. |
tunnels.external.enabled / .url |
false / "" |
Any other tunnel you run yourself: Cloudflare Tunnel, Caddy, ssh -R. Same deal — URL only. |
Configs written before tunnels were grouped still load: a top-level
ngrokblock becomestunnels.ngrok, and a top-levelpublicUrlbecomestunnels.external.url— keeping its old precedence over ngrok, so upgrading never silently re-points an existing pairing.
Public access with an external tunnel
LAN mode only reaches devices on the same Wi-Fi. To view from mobile data, another network, or a car on the road, run Airc behind a public tunnel.
If you already run a tunnel — or want one Airc doesn't manage — give it a URL
under tunnels and Airc will advertise that address everywhere it prints a
link. It never starts or supervises the tunnel; that stays your job (a systemd
unit, the tunnel's own background mode, whatever you prefer).
{
"tunnels": {
"tailscale": { "enabled": true, "url": "https://your-host.example.ts.net" }
}
}
tailscale and external behave identically — the split is just so a Funnel
URL and, say, a Cloudflare one can both sit in the config and be swapped by
reordering prefer, without deleting either.
Any scheme works as long as it terminates TLS and proxies to Airc's HTTP port. Tailscale Funnel is a good free choice: it gives a stable HTTPS hostname with no interstitial, and the viewing device needs nothing installed.
# one time, on the machine running Airc
tailscale up
tailscale funnel --bg 8080 # public on :443, proxying to Airc on :8080
tailscale funnel status # prints the https://<host>.ts.net URL
Funnel must be enabled once for your tailnet; tailscale funnel prints an admin
URL if it isn't. Funnel only exposes ports 443, 8443 and 10000, so the public URL
carries no port even though it proxies to 8080.
One caveat: Tailscale Funnel does not pass a per-client X-Forwarded-For, so
Airc sees every tunnelled request as coming from the local Tailscale address.
Its failed-auth throttle and the 8-websockets-per-address cap therefore apply to
all Funnel traffic as one bucket. Fine for personal use; worth knowing if you
share the URL.
Public access with ngrok
Airc can also start and supervise ngrok itself. Its free tier gives you one reusable static domain, which makes a durable bookmark.
Known problem: ngrok's free tier serves an interstitial warning page to any browser that hasn't clicked through it in the last 7 days, and that page does not render in the Tesla browser — Airc never loads, on any path. The documented workarounds (
ngrok-skip-browser-warning, a customUser-Agent) are blocked on free accounts, Traffic Policy included. Use an external tunnel or a paid plan.
Airc ships with
ngrok.enabled: falseand a placeholder domain. The steps below are what turn it on; nothing here happens until you do them.
1. Install the ngrok agent and sign up for a free account: https://ngrok.com/download.
2. Add your authtoken (one time, from your ngrok dashboard):
ngrok config add-authtoken <YOUR_AUTHTOKEN>
3. Claim a free static domain in the dashboard
(Universal Gateway → Domains). You'll get something like
your-name-1234.ngrok-free.dev.
4. Point Airc at it in config.json:
{
"tunnels": {
"ngrok": {
"enabled": true,
"domain": "your-name-1234.ngrok-free.dev",
"binary": "ngrok",
"apiUrl": "http://127.0.0.1:4040"
}
}
}
domain— the reserved domain from step 3 (nohttps://). Replace the placeholder, or the tunnel will fail to bind a domain you don't own.binary— path to the ngrok agent if it isn't on your$PATH.apiUrl— ngrok's local API; Airc reads the live tunnel URL from it. The default is correct unless you've changed ngrok'sweb_addr.
5. Start in tunnel mode and pair:
tools/airc on # Airc supervises the ngrok child process
tools/airc pair-web # QR/URL now points at your public domain
Airc starts and restarts the ngrok agent for you while the server runs; you do
not run ngrok separately.
Notes on the free tier:
- Only one active ngrok agent session is allowed. If you already have an
ngrokrunning manually, it will block Airc's supervised child — stop it first. - Free domains show an interstitial warning page on first visit in a browser.
- If the tunnel doesn't come up, check the log:
tail -f "$(tools/airc logs)".
Running more than one tunnel
Nothing stops several tunnels being enabled at once — each one that's up still
reaches the server. tunnels.prefer decides which URL gets baked into bookmarks
and pairing payloads; the rest are unadvertised routes you (or an
already-paired app) can still use.
{
"tunnels": {
"prefer": ["ngrok", "tailscale", "external"],
"ngrok": { "enabled": true, "domain": "your-name-1234.ngrok-free.dev" },
"tailscale": { "enabled": true, "url": "https://your-host.example.ts.net" }
}
}
That config advertises ngrok and keeps Funnel as a spare: swap the first two
entries in prefer to flip it, with no other edit. Bookmarks and QR payloads
change on the next restart, so re-pair (or let the app pick the new URL up on
its next /api/config refresh) after a swap.
--no-ngrok skips starting the agent but leaves the other tunnels advertised;
--no-tunnels (what tools/airc local passes) advertises none of them.
LAN and tunnel at the same time
Handy if you want the phone/app to use a fast direct LAN connection at home and the tunnel only when you're away. The server has to bind a non-loopback address and keep a tunnel enabled:
tools/airc on --host 0.0.0.0
(or set "host": "0.0.0.0" in config.json). With the default host: 127.0.0.1, only ngrok can reach the server — same-Wi-Fi devices get
connection-refused. Verify the bind:
ss -tlnp | grep 8080 # should show 0.0.0.0:8080, not 127.0.0.1:8080
The Android app stores both URL families from one pairing and fails over between them automatically. More detail in docs/operations.md.
App over HTTPS
The Android app talks to the server over HTTPS/WSS, even on the LAN, so the control token and your keystrokes are encrypted on the local network. This is automatic and needs no setup:
- On first run the server generates a long-lived self-signed certificate
(
.airc-tls-key.pem/.airc-tls-cert.pemat the repo root, both0600, both git-ignored) and serves HTTPS ontls.port(default8443) alongside the plain HTTP port. - Browsers keep using plain HTTP — they can't accept a self-signed cert, and that zero-install browser viewer is the point. Only the app uses HTTPS.
- The certificate's fingerprint travels inside the pairing QR. The app pins it (trust-on-first-use, anchored by the QR you scan in person), so it trusts only your server — not any CA. The ngrok tunnel keeps its normal public certificate; the app validates that against the system trust store as usual.
If
opensslisn't installed, the server logs a warning and falls back to HTTP-only — but the app then can't connect on the LAN. Installopenssl(it's usually already present) to use the app at home.
Re-pair when the certificate changes. The app pins the exact certificate it
was paired with, so re-scan the QR (tools/airc pair-app) if you:
- reinstall the server or delete the
.airc-tls-*.pemfiles (a new cert is generated, so the old pin no longer matches), or - upgrade from an older app/server that paired before HTTPS existed.
Until you re-pair, the app reaches the server over the ngrok tunnel (if enabled) but not directly on the LAN.
Installing the Android app
The app is optional — the browser viewer needs none of this.
Sideload the prebuilt APK (easiest)
Each release attaches a signed APK named airc-<version>.apk:
- On the phone, open the
latest release and download
airc-<version>.apk. - Tap the downloaded file. Android will ask you to allow installing from this source (Settings → Install unknown apps for your browser/file manager); grant it once.
- Install, then open Airc Tmux, tap
pair, and scan the QR fromtools/airc pair-app.
The APK is signed with a stable release key, so later versions install straight over the top — no uninstall needed. (It's self-signed, not from the Play Store, so the first install shows the usual "unknown source" prompt.)
Build it yourself
Prefer to build from source? You'll need the Android toolchain.
Requirements:
- Android SDK
- JDK 17
- A device (or emulator) with USB debugging enabled for installation
The repo-root Makefile wraps the common flow and only rebuilds when sources
changed:
make build # assemble the debug APK
make push # rebuild if needed, then adb install -r
make deploy # push and launch on the device
make help # list all targets
Equivalent raw commands, from android-app/:
cd android-app
./gradlew assembleDebug
adb install -r app/build/outputs/apk/debug/app-debug.apk
This project was built against Android SDK at ~/android, Gradle
~/android/gradle-9.4.1, and JDK 17 at ~/android/jdk-17; the Gradle wrapper is
checked in. Adjust paths for your setup — android-app/local.properties (your
SDK path) is machine-local and git-ignored. See
docs/development.md for the full build/test
notes.
Once installed, open Airc Tmux, tap pair, and scan the QR from
tools/airc pair-app. The app stores the profile, so you only re-pair when the
server address, a token, or the TLS certificate changes.
Zsh completions
completions/_airc completes subcommands, status --json, and the server flags
for on/local/restart (with live tmux session names for --session). Put it
on your $fpath:
ln -s "$PWD/completions/_airc" ~/.zsh/completion/_airc # a dir on your $fpath
Restart zsh (or rerun compinit) to load it.