Linkdocs

How the phone connects

At home, away on another network, and on networks that get in the way, without opening a port on your router.

You don't set anything up for this. You pair once, and each time you open the computer in the app, it works out the way in by itself. While it connects, the app says which way it's going, such as "Direct path, no relay".

Your computer is never opened up to the internet. Link Host only makes outgoing connections, the same as a browser does, so you never forward a port, change a firewall or run a VPN. Whatever the route, what travels is encrypted between the app and your computer.

The ways in

Direct

The phone connects straight to the computer, wherever both of them are. This is what you get almost every time.

Through your relay

On networks that block direct connections, a relay you run on your own Cloudflare account passes the encrypted data along.

Same network only

If you turned the rest off, the phone connects only when it can reach the computer's address: the same Wi-Fi, or a VPN you already use.

Which of them you have depends on how you paired:

The default: direct, from anywhere

A plain link-host ssh setup pairs this way, with nothing of yours running anywhere else. To find each other, the phone and the computer use a public message service, ntfy.sh, which only ever sees a couple of sealed messages it can't read. The session itself then goes straight between the phone and the computer.

Some networks, such as some mobile carriers and office networks, don't allow two devices to connect directly. There the app says "No direct path from this network": try another network, or pair through your own relay. The free ntfy.sh allows 250 messages a day from one internet address, and each connection uses two.

Through your own relay

link-host ssh setup --relay wss://link-relay.example.workers.dev

A relay is a small server on your own Cloudflare account, free, set up with one command (Your own relay). The phone and the computer still connect directly whenever they can; when they can't, the relay passes the encrypted data between them, so you're connected on any network. It only lets in phones you paired. Link doesn't run a public relay yet.

On the same Wi-Fi, or with Tailscale

From the next app update, the app first tries the computer's own addresses for a moment, whichever way you paired: the one it had when you paired, and the ones Link Host gave on the last connection. If the phone can reach one, because it's on the same Wi-Fi, or because Tailscale or another VPN runs on both, the app signs in there straight away, without the meeting point or the relay. That usually takes a fraction of a second instead of a few seconds. The app doesn't wait for them to fail: unless one answers within 0.15 s, it starts connecting the usual way alongside, and uses whichever connects first. So away from home this costs nothing.

It only signs in to an address that proves it's your computer, with the same key you trusted when pairing. Another device at that address on some other network is ignored, without a warning.

To use Tailscale, install it on the computer and the phone, signed in to your own Tailscale account, and keep it on. Nothing changes in Link: once Link Host has given the computer's Tailscale address on one connection, the app tries it first from then on. On Android, Tailscale is a VPN, and the phone runs one VPN at a time.

Coming back to the app

Link stays connected for 15 minutes after you leave it, so coming back to it within that time needs no new connection. The 15 minutes count while the phone is locked and asleep too. While it does, Android shows a quiet notification, Link is connected, with a Disconnect button. It goes away when you come back, when you tap Disconnect, after the 15 minutes, or once Link isn't using any connection (for example after you swipe it away in Recents). Disconnect closes the connections to your computers; nothing reconnects until you open Link again.

When it does have to connect again, the Agents tab shows what was running last time straight away, marked with its age ("As of 5 min ago · connecting…"), and replaces it with what's running now as soon as the computer answers. From the next app update, the same goes for a chat you open (its last messages), the Terminal tab's list, and a terminal you open (its last screen, dimmed) until tmux draws the real one.

When a network changes

  • The phone moves, say from Wi-Fi to mobile data: on a direct connection the session carries on by itself. With Link Host 0.1.3 and the next app update, that works even though your computer's firewall blocks incoming connections: the phone tells the computer its new address through the relay or the meeting point, and the computer lets it in. If it still can't, the app reconnects within a few seconds. Terminals and agents keep running on the computer either way.
  • The computer moves to another network, or wakes from sleep: the app reconnects once Link Host is back in touch. From Link Host 0.1.3 that's about a second after the computer is on the new network; before, it could take up to a couple of minutes.

Who's in the middle

Way inWho's in the middleOpen port on your computer
DirectNobody. ntfy or your relay only introduced the two sidesNo
Through your relayYour relay, which can't read what it passesNo
Same network onlyNobodyPort 2222, on your network

Whatever the way in, the phone checks it's talking to your computer, using the key it saved when you paired. A computer that presents a different key is refused (see Security).

Firewalls on the computer

Only the same-network way needs the computer to accept incoming connections on port 2222. Some distributions (Arch Linux, for one) block that by default; setup notices and prints the one command that allows it. The other ways need nothing.

On this page