Apus has two related but distinct discovery problems:

  1. Operator remote control: the macOS menu bar app controlling a Gateway running elsewhere.
  2. Node pairing: iOS/Android (and future nodes) finding a Gateway and pairing securely.

All network discovery/advertising lives in the Gateway (apus gateway); clients (mac app, iOS) are consumers only.

Terms

Protocol details: Gateway protocol.

Why direct and SSH both exist

Discovery inputs

1) Bonjour / DNS-SD

Multicast Bonjour is best-effort and does not cross networks. Apus also supports browsing the same Gateway beacon via a configured wide-area DNS-SD domain, so discovery can cover both local. on the same LAN and a configured unicast DNS-SD domain for cross-network discovery.

The Gateway advertises its WS endpoint via Bonjour when the bundled bonjour plugin is enabled; clients browse and show a "pick a Gateway" list, then apply their connection trust policy. On macOS, a selection opens the connection editor; it does not save the advertised endpoint. See Configure in the app.

Troubleshooting and beacon details: Bonjour.

Service beacon details

Security notes:

Enable, disable, and override:

2) Tailnet (cross-network)

For Gateways on different physical networks, Bonjour will not help. The recommended direct target is a Tailscale MagicDNS name (preferred) or a stable tailnet IP.

If the Gateway detects it is running under Tailscale, it publishes tailnetDns as an optional hint for clients (including wide-area beacons). For a configured macOS connection, prefer a trusted MagicDNS name over a raw Tailscale IP so the name resolves to the current address. Discovery does not replace the saved address.

For mobile node pairing, discovery hints never relax transport security on tailnet/public routes:

3) Manual / SSH target

When there is no direct route (or direct is disabled), clients can always connect via SSH by forwarding the loopback Gateway port. See Remote access.

Transport selection (client policy)

The macOS app uses its configured direct or SSH transport. Discovery does not replace that route or select a fallback. For a new connection, the user supplies a trusted address, SSH target, or setup code in the connection editor and saves it.

Discovery-based client selection follows this policy:

  1. If a paired direct endpoint is configured and reachable, use it.
  2. Else, if discovery finds a Gateway on local. or the configured wide-area domain, offer setup for that candidate. Apply the client's trust policy before saving a direct endpoint; discovery alone is not authorization.
  3. Else, if a tailnet DNS/IP is configured, try direct. For mobile nodes on tailnet/public routes, direct means a secure endpoint, not plaintext remote ws://.
  4. Else, fall back to SSH.

Pairing and auth (direct transport)

The Gateway is the source of truth for node/client admission:

Responsibilities by component

Related