honestly just guess what it does. You're probably right.
Files
README.md

Caution

The README file below this message, as well as essentially all code and documentation associated with this project, should be considered to be slop. None of it contents has undergone rigorous assessment by a human (or for that matter rigorous assessment by an LLM). It should not be assumed to be robust, and the the author is aware of at least one bug in the web UI that will only be fixed if and when he feels like it. The presence of commits in this repository that do not have trailers indicating that they are assisted by AI in this repository should be taken solely as a sign that the author is Incredibly Fucking Lazy. The only guarantee I can give you is that it does, in fact, Work On My Machine, and serves to address some of the problems of gay nerds in long-distance relationships. Consider yourself warned.

tsbutt #

Tailnet-exposed toy control: an Android app that embeds Tailscale (tsnet) via gomobile and serves a small control webapp to your tailnet over HTTPS (and over plain HTTP on port 80). The webapp talks to Intiface Central (installed and running on the same phone) through buttplug.js.

tailnet browser (desktop or phone)
   │  https://<machine>.ts.net/               (HTTPS terminated by tsnet via Let's Encrypt)
   │  http://<machine>.ts.net/                (same handler, plain HTTP on :80)
   ▼
tsnet (userspace netstack, in-process, no VPN service) — Go, in tsbridge AAR
   │  Go net/http server (webapp and WebSocket proxy both at /; upgrades go
   │  to the proxy, plain GETs get the webapp)
   ▼
httputil.ReverseProxy ──► 127.0.0.1:12345  (Intiface Central's WebSocket server)

The Android app has zero toy intelligence: it serves static files and proxies WebSockets, nothing more. Non-Go Android code is Kotlin/Jetpack Compose; the webapp is vanilla ESM JavaScript with a vendored buttplug.mjs (no CDN, no bundler, no build step).

Prerequisites #

Tailnet settings (Tailscale admin console):

  • MagicDNS and HTTPS certificates must be enabled — tsnet cannot get its Let's Encrypt cert otherwise. If they are off, the app reports a clear error and the desktop runner prints it.

Phone-side prerequisites:

  • Intiface Central installed, connected to the toy, "allow incoming connections" enabled, WebSocket server on its default port (12345).
  • Battery optimization disabled for both Intiface Central and tsbutt, or Android will eventually kill them in the background.

Security note: while the service is running, any device in your tailnet can reach the control page. Toggle the service off when not in use.

Troubleshooting #

Connecting Intiface Central (desktop) in Repeater mode. The desktop app forwards its local 127.0.0.1:12345 to a remote buttplug server — set tsbutt as the remote server:

  • Remote Server Address: <hostname>.ts.net:80 (the "Copy HTTP" address without the http://). Repeater mode cannot do TLS, so it must use port 80; port 443 is HTTPS-only. A bare hostname (no port) also works.
  • Do not paste a http:// or https:// URL. The repeater prepends ws:// to whatever is entered (Intiface Engine ≤ 3.0.1 requires the ws:// prefix yourself), so a pasted scheme produces an unparseable address like ws://http://… and the connection dies before it reaches tsbutt.
  • No path is needed: tsbutt accepts WebSocket upgrades on any path, like Intiface's own server.
  • Then connect the desktop app to 127.0.0.1:12345 as usual.

"Running" in the app but SSL connections fail. "Running" only means the listener is up; certificate provisioning happens right before it and now fails loudly (see the status card) if it can't get a cert. If the cert is fine, check these:

  • Don't test from the same phone. Without the system Tailscale app the phone's browser can't resolve <name>.ts.net; with it, the connection is routed by the system client, which is the least reliable path (see below). Test from a second tailnet device.
  • Running the Tailscale system client on the same phone generally coexists with tsbutt (tsnet uses no VPN service; the tsbutt node is just a second device in the tailnet, and its control/DERP traffic is forwarded by the system client like any app's internet traffic). But same-phone access goes through the system client's routing to the tsbutt node as a peer, which is flaky in practice. If other devices can connect but the phone itself can't, that's this — pause the system client's VPN or use another device.
  • Keep the hostname stable: each new hostname provisions a new cert and can hit certificate issuance rate limits.

Build #

Everything builds inside the Nix devshell (Go, gomobile, JDK, Gradle, Android SDK + NDK):

nix develop

# Go tests and vet
go test ./tsbridge/...
go vet ./tsbridge/...

# Android AAR from the Go module
(cd tsbridge && gomobile bind -target=android -androidapi 26 -o ../app/libs/tsbridge.aar .)

# Debug APK
gradle :app:assembleDebug
# → app/build/outputs/apk/debug/app-debug.apk

The devshell shell hook installs the pinned gomobile into .tools/bin on first use and runs gomobile init once.

Desktop runner (no tsnet, plain HTTP — handy for webapp development):

go run ./tsbridge/cmd/desktop -addr 127.0.0.1:8484

Desktop runner over tsnet (validates the full path without a phone):

go run ./tsbridge/cmd/desktop -tsnet -hostname tsbutt-desktop
# state defaults to ~/.local/state/tsbutt (persistent — holds node identity
# and the Let's Encrypt cert cache); prints status JSON until interrupted

Non-interactive auth works with a Tailscale OAuth client secret too — create one in the admin console (with a tag granted, e.g. tag:server) and pass the tskey-client-... secret as the auth key plus the tag:

go run ./tsbridge/cmd/desktop -tsnet -hostname tsbutt-desktop \
    -authkey 'tskey-client-...?preauthorized=true' -advertise-tags tag:server

tsnet mints an ephemeral auth key via OAuth; ?ephemeral=false and ?preauthorized=true can be appended to the secret to change the minted key's properties. Start waits for the Let's Encrypt certificate to be provisioned before reporting ready, so the first page load does not time out during ACME issuance.

On-device testing checklist #

  1. Install the debug APK; grant the notification permission.
  2. Enter your auth key in Settings (or leave empty and complete the interactive login at the URL shown in the status card).
  3. Tap Start remote control; confirm the status card shows a tailnet IP and cert domain.
  4. From a second tailnet device, open https://<hostname>.ts.net/ — the page must load over a valid TLS cert. Then open http://<hostname>.ts.net/ — the same page must load over plain HTTP and the controls must work there too (the page connects to / with ws:// because its own scheme is http:).
  5. Connect to the toy through the webapp: slider, hold button, pattern playback, and emergency stop should each work end-to-end.
  6. Screen off / app backgrounded: the service must stay up and the controls must still respond.

Keep the hostname stable (single setting, default tsbutt): repeated machine renames can hit Let's Encrypt issuance rate limits.

Layout #

  • flake.nix — devshell only; no package output.
  • tsbridge/ — Go module: HTTP server + tsnet + Android workaround; tsbridge/webapp/ — the control page; tsbridge/README.md — module notes.
  • app/ — Kotlin/Compose Android project (Gradle root is the repo root).
  • AGENTS.md — working conventions for agents.