flextunnelguides

The Android app

flextunnel's Android app reaches your servers' private ports and networks from the phone, without a VPN. Other apps use it through a SOCKS5 proxy on a fixed loopback port (127.0.0.1:1080 by default) and through port forwards: local ports that each lead to one host and port. Both run in one session, with an ongoing notification, and keep serving while the app is in the background.

What you need

  • A running flextunnel server and its endpoint ID (node id): a CLI server, or the desktop app's server role.
  • The public half of this app's auth key on that server's authorized keys (see Set it up).
  • A phone on Android 14 or later, arm64-v8a or x86_64.

Install

Releases on the releases page carry flextunnel-android-<version>-unsigned.apk. It is unsigned, and Android does not install an unsigned APK, so sign it with a key of your own first, for example with the Android SDK's apksigner:

Terminal
# once: a signing key of your own (keep it and its password)
keytool -genkeypair -v -keystore flextunnel-release.jks -alias flextunnel \
  -keyalg RSA -keysize 4096 -validity 10000

# sign the downloaded APK (apksigner is in the Android SDK's build-tools)
apksigner sign --ks flextunnel-release.jks --ks-key-alias flextunnel \
  --out flextunnel-android.apk flextunnel-android-VERSION-unsigned.apk

# install it on the phone, with USB debugging on
adb install flextunnel-android.apk

Keep the keystore and its password: Android only accepts an update signed with the same key. To build a signed APK from source instead, see the repository's README.

The app asks to post notifications and, on Android 17 and later, for local network access. Both permissions are optional. Local network access enables discovery and direct connections on the LAN. The app can still reach servers through relays without it.

Set it up

  1. Auth key. Open Settings (the gear), and next to Auth key tap Manage. Tap +, then Generate new key…, or Enter existing key… to paste an ed25519-sec:… key. Go back and choose the key under Auth key, then save.

    Copy its public key (ed25519-pub:…) with Copy public key in the key's menu, and put it in each server's authorized keys.

  2. Destinations. Tap + next to Destinations. Enter a Name (one DNS label, for example nas) and the Server node id the server prints (SERVER_ENDPOINT_ID). nas.localhost.flextunnel.internal:<port> then reaches that port on the server itself. Under Routes (optional), domains (name, *.suffix or *, such as *.corp.example) and IP ranges (such as 10.0.0.0/8) send more hosts through this server; the server must route them too. Fetch from server fills the routes with the server's own lists. Save.
  3. Port forwards (optional). Tap + next to Port forwards. For example local port 2222 → remote host nas.localhost.flextunnel.internal, remote port 22; then any SSH app connects to 127.0.0.1 port 2222. Its host must be a server's loopback name or on a destination's routes.
  4. Start. Tap Start. A destination connects when something is first sent to it. Stop ends the session.
The home screen with a destination and a port forward, before Start. Taken with the app 0.0.3 on core 0.0.115, as its footer shows.
Adding a destination with its routes.
Settings: the auth key, the SOCKS5 port and relays.

Use the SOCKS5 proxy

While the session is on, the SOCKS5 proxy listens at 127.0.0.1:<port> (1080 unless changed in Settings), with no password.

The one rule: resolve names through the proxy. Set the client to SOCKS5 and have it send hostnames to the proxy — "remote DNS", "proxy DNS" or socks5h. Names like <name>.localhost.flextunnel.internal only exist on the far side; looked up on the phone they fail with "address not found". Sending everything through the proxy is fine: a host no destination routes connects directly.

Firefox and FoxyProxy

Firefox for Android has no proxy setting of its own, but it runs the FoxyProxy Standard add-on.

  1. In Firefox, open FoxyProxy Standard on addons.mozilla.org, then Add to FirefoxAdd.
  2. Menu (⋮)ExtensionsFoxyProxy⚙ (Settings)ProxiesAdd:

    • Title: flextunnel (anything)
    • Type: SOCKS5
    • Hostname: 127.0.0.1
    • Port: the app's SOCKS5 port, 1080 by default
    • Proxy DNS: on (the default) — the remote DNS above
    • Username / Password: empty

    Then Save. The form is wider than the screen: scroll it sideways to reach Hostname and Port.

  3. Menu (⋮)ExtensionsFoxyProxy (the row, not the ⚙) opens the popup. Pick flextunnel to send all traffic through the proxy, or Disable to turn it off.
  4. Open http://<name>.localhost.flextunnel.internal:<port>/ for a service on a server's own loopback, or a routed host by its usual name.

If a routed name shows "Address Not Found" right after Firefox starts, reload. If routed names keep failing while public sites work, turn off Firefox's DNS over HTTPS.

Chrome

Chrome for Android has no proxy setting and no extensions, and Android's own Wi-Fi proxy setting takes an HTTP proxy or a PAC URL, not SOCKS5. Use Firefox for internal sites, or a port forward for a single host.

Other apps

  • Apps with a SOCKS5 setting (SSH clients, some download managers, Termux tools): 127.0.0.1, the port, no authentication, remote DNS on if offered. In Termux: curl -x socks5h://127.0.0.1:1080 http://nas.localhost.flextunnel.internal:8080/.
  • Apps without a proxy setting use a port forward, as in Set it up.

Settings

  • SOCKS5 proxy: on or off, and the Port on 127.0.0.1.
  • Relays: custom relay URLs, one per line (empty for the defaults), and a relay auth token. Turn QUIC address discovery off for relays behind a Cloudflare Tunnel or another HTTP-only front.
  • Background: if your phone stops the app in the background, turn battery optimization off for Flextunnel with Battery optimization settings.

Saving settings, or a destination, restarts a running session.

Good to know

  • Any app on the phone can use the proxy and the forwards while the session is on, since they have no password. Stop the session when you don't need it.
  • If another app holds the SOCKS5 port, the session won't start: pick another port in Settings and update the browser.
  • A destination showing Refused means its server doesn't authorize the auth key: add the key's public half there.
  • A destination that never connects, though its server runs and its node id is current, may speak another protocol. Compare the version line at the bottom of the home screen, such as core X.Y.Z · protocol N, with the server's flextunnel --version, and upgrade the end whose protocol is older.