flextunnelguides

The macOS and Windows app

flextunnel's tray app for macOS and Windows. It has two roles, and you can use either one or both: a client of any number of flextunnel servers elsewhere, with a local SOCKS5 or HTTP proxy and port forwards, and this computer's own server, run inside the app. Nothing needs a terminal. The app lives in the menu bar or system tray and keeps running with its window closed.

What you need

To use the app as a client:

  • A running flextunnel server, and its endpoint ID. The server can be a CLI server or another computer running this app in its server role (see The server).
  • The public half of this app's auth key on that server's authorized keys (see Auth keys).

To use the app as a server, you need nothing else.

The app runs on Apple-silicon Macs (arm64) and 64-bit Windows (amd64).

Install

The installers are on the releases page. They are unsigned, so macOS Gatekeeper and Windows SmartScreen warn about them. The simplest way around both is to download with curl instead of a browser, since browsers mark downloaded files and curl does not.

macOS

  1. Download the disk image from the terminal:

    Terminal
    curl -fL -o flextunnel-desktop.dmg \
      https://github.com/flexaccessdev/flextunnel/releases/latest/download/flextunnel-desktop-macos-arm64.dmg
  2. Open the .dmg, drag flextunnel.app onto Applications, then eject the disk image.
  3. Open flextunnel from Applications.

If you downloaded it with a browser and macOS says "flextunnel" is damaged and can't be opened, run:

Terminal
xattr -cr /Applications/flextunnel.app

Windows

  1. Download the installer in PowerShell:

    PowerShell
    curl.exe -fL -o flextunnel-desktop.msi `
      https://github.com/flexaccessdev/flextunnel/releases/latest/download/flextunnel-desktop-windows-amd64.msi
  2. Run the downloaded .msi.

If you downloaded it with a browser and SmartScreen shows "Windows protected your PC", click More infoRun anyway.

The app starts at login. The tray menu's Open at Login (macOS) or Start with Windows (Windows) turns that off.

The window

You don't pick a role: in the sidebar, click + next to Destinations to reach a server elsewhere, or Set up server… to let your other devices reach this computer. Proxy & forwards holds the client's switch, proxies and port forwards.

The client running with two connected destinations, the SOCKS5 proxy and a port forward. Screenshots on this page were taken on macOS with flextunnel 0.0.115, as the sidebar shows.

Auth keys

An auth key is how a server knows this computer. Any number of destinations can use the same key.

The Keys pane: one key, its public half, and the destinations that use it.
  1. Select Keys in the sidebar and click + Add key.
  2. Give it a Name (for example work laptop), click Generate (or paste an existing ed25519-sec:… key into Secret key), and click Save.
  3. Copy the key's Public key (ed25519-pub:…) to each server that should accept it: into a CLI server's authorized-keys file, or under Authorized clients on a desktop server.

You can also make a key while adding a destination, with New key… next to its Auth key picker.

Add a destination

A destination is one server the client reaches, under a name you pick. Click + next to Destinations and fill in the form:

FieldWhat goes in it
NameOne DNS label, for example nas. <name>.localhost.flextunnel.internal:<port> then reaches that port on the server machine itself.
Server node idThe server's endpoint ID (SERVER_ENDPOINT_ID).
Routed domains, Routed CIDRsOptional, comma-separated: further names or IP ranges to send through this server, such as *.corp.example or 10.0.0.0/8.
Auth keyThe key to authenticate with, picked from the Keys list.
Relay URLs, Relay auth token, QUIC discoveryOnly for custom relays; leave empty for the default relays. Untick QUIC discovery for relays behind a Cloudflare Tunnel or another HTTP-only front.

Click Save. The server must authorize the key's public half.

Adding the destination nas: its server node id, the domains and CIDRs to send through it, and the auth key.

Select a destination in the sidebar to see its state, its routes, and its server's status page, http://flextunnel.internal/servers/<name>/. A rule the server doesn't fully route is marked server: partial or server: none.

A connected destination: its settings, the server's own loopback name, its routes, and its server's status page.

Fetch from server

A route only helps if the server allows it too. To start from what the server allows, click Fetch from server under the two route fields. It needs the Server node id and an auth key the server already authorizes, and its answer replaces what both fields held. Review it, then save.

When destinations overlap

Where two destinations' routes overlap, the more specific rule wins. A proxy request that no destination routes connects directly from this computer; a port forward never does.

Use the proxy

Under PROXIES on the Proxy & forwards pane, the SOCKS5 proxy is on at 127.0.0.1:1080 by default; an HTTP proxy can be turned on with Edit.

Point any proxy-aware app at 127.0.0.1:<port>. Use the SOCKS5 proxy with remote name resolution (socks5h://), so the names reach the proxy instead of failing in this computer's DNS.

Terminal
# a web app on port 8000 of the server named nas
curl --proxy socks5h://127.0.0.1:1080 http://nas.localhost.flextunnel.internal:8000/

# a host on one of office's routes
curl --proxy socks5h://127.0.0.1:1080 http://wiki.corp.example/

Setting up browsers, git, ssh and other tools is in Use the proxy from your apps. Through the proxy, http://flextunnel.internal/ shows the client's own status.

Port forwards

A port forward binds a local port to a host:port reached through a destination, for tools that can't use a proxy. Forwards listen on localhost only.

  1. On the Proxy & forwards pane, click + Add next to PORT FORWARDS.
  2. Fill in the Local port, the Remote host and the Remote port. For SSH on the server named nas: local 2222, remote host nas.localhost.flextunnel.internal, remote port 22.
  3. Leave Enabled ticked and click Save. Then connect to localhost:2222.

The remote host must be a destination's <name>.localhost.flextunnel.internal or on one of its routes. Each forward's row shows which destination carries it (via nas), or no route.

Adding a port forward: local port 5432 to db.home.example:5432, reached through whichever destination routes it.

Connecting and turning it off

A destination connects when something is first sent to it, and disconnects again after five minutes unused. The Enabled switch on the client's pane, also Enable Client / Disable Client in the tray, turns the client on and off.

Saved changes take effect at once, without a restart. A change the client can't apply, such as a port another program holds, is shown as not applied.

Move destinations to another computer

Export at the bottom of the sidebar saves the destinations and port forwards to a JSON file; Import reads one back on another computer. Auth keys and relay tokens are not in the file, so you re-enter them after an import.

The server

The app can host one server, so your other devices reach this computer, and the network it is on, from anywhere. Nothing needs opening on your router.

Set up server… opens this page first: what a server needs, in three steps.

Set it up

  1. Click Set up server… in the sidebar or the tray, then Set up server.
  2. Under Identity, choose New identity, or Import existing key to move a server here with its endpoint ID (then stop the old one). Click Create server.
  3. Under AUTHORIZED CLIENTS, click + Authorize client. Paste the client's public key (ed25519-pub:…), or pick or use one of my keys…. Give it a Name (for example alice laptop) and click Authorize. For CLI clients' keys, see flexaccess-keys.
  4. Copy the ENDPOINT ID at the top of the server pane, or Copy Endpoint ID in the tray, and enter it on each client as the server node id.

The server starts with its first authorized client.

This computer's server, running with one authorized client: its endpoint ID, the authorized clients, and the tunnel set.

What clients reach

Clients can always reach this computer's own localhost, on any port, at <name>.localhost.flextunnel.internal. TUNNEL SET & RELAYS → Edit sets what else they may reach:

  • Routed domains — comma-separated, for example *.internal; * for every name.
  • Routed CIDRs — comma-separated, for example 10.0.0.0/8; 0.0.0.0/0, ::/0 for every address.

A client must also list a route itself to send it to this server. The same form sets custom relays.

Turning it off

Enabled on the server pane, also Enable Server / Disable Server in the tray, turns the server on and off. Saved changes restart a running server, and its clients reconnect when next used. Remove… takes a client off; Delete server… removes the server and its identity for good. Export key… under the endpoint ID copies the identity key, to move the server to another computer.

The tray menu

The menu bar or tray icon's menu opens the window, shows the client's and the server's status with their enable and disable items, and has Copy Endpoint ID and Quit flextunnel.

The menu bar menu with the client and the server both running.

Logs

The Logs pane shows the app's live log, filtered to All, Client or Server. Open folder opens the log files: ~/Library/Logs/flextunnel on macOS, %LOCALAPPDATA%\flextunnel\logs on Windows.

Where settings live

Settings are in profiles.json, in ~/Library/Application Support/flextunnel on macOS and %LOCALAPPDATA%\flextunnel on Windows. Secrets are sealed in that file with a master key kept in the system keychain under Flextunnel Safe Storage. If the store or the server identity can't be loaded, see Recovery in the app's README.

Troubleshooting

What you seeWhat to do
A destination shows refusedThe server doesn't authorize its key. Add the key's public half on the server.
retrying… or last attempt failedCheck that the server is running and that the Server node id is its current endpoint ID.
A destination never connects, though its server runs and the node id is currentThe two ends may speak different protocols. Compare the version at the bottom of the sidebar, such as vX.Y.Z (protocol N), with the server's flextunnel --version, and upgrade the end whose protocol is older; see Install.
A routed name fails with a DNS errorUse the SOCKS5 proxy with remote name resolution (socks5h://); see Use the proxy from your apps.
A rule marked server: none or server: partialAdd it to the server's tunnel set, or use Fetch from server.
A forward shows no routeUse a destination's <name>.localhost.flextunnel.internal, or add the host to a destination's routes.
not applied after a save, or the client failedUsually a local port another program holds. Pick a free port, then switch the client off and on.
"flextunnel" is damaged and can't be opened on macOSRun xattr -cr /Applications/flextunnel.app; see Install.