Repository navigation
Desktop exposure carries a listen-interface selection (#7) - #14
Merged
Merged
Conversation
…re state Desktop exposure was a two-valued mode, so the desktop could only ask for loopback or everything, and it had to pick a bind host itself. Exposure state and the set-exposure IPC now carry `listenInterfaces` (ADR 0003) plus the preset, the resolver's addresses and warnings, and whether Tailscale Serve is available. The legacy `mode` stays as a derived field so upstream consumers keep working. `formatListenHostSelection` gives a selection its `--host` spelling for the bootstrap envelope, which the server already parses, and `listenInterfacesEqual` compares two selections as sets.
The desktop resolved exposure itself and sent the backend a bind host, either `127.0.0.1` or the `0.0.0.0` wildcard, so it could not ask for the tailnet without also opening the LAN. Desktop settings now persist `listenInterfaces` (ADR 0003), migrating one-way from the legacy key and dual-writing the derived `serverExposureMode` so an upstream build still reads something sane after a downgrade. The bootstrap envelope carries the selection in `--host` form and the server resolves it, so the desktop never sends a resolved address or a wildcard. Endpoints follow the selection: no LAN endpoint without `lan`, no tailnet endpoint without `tailnet`, one endpoint per explicit address. Tailscale Serve is offered only while `tailnet` is selected, and any change to the selection as a set relaunches the backend. The new resolution logic lives in the fork-only `desktopExposureSelection`; upstream files take call-site edits only. Interim: until the multi-bind ticket lands, a `lan` selection still binds the first resolved address and warns about the rest.
The `lan` preset carries `tailnet`, so gating on the selected kind alone spawned `tailscale status` on every LAN machine with no Tailscale at all. The old mode-based guard did not, because the fallback had already read the mode back as local-only. On Mac App Store builds that spawn raises the "Other apps" TCC prompt. Gate the spawn, the envelope's Serve flag, and `tailscaleServeAvailable` on a tailnet address having actually resolved, not on the kind being selected.
…host CONTEXT.md reserves "host" as a term to avoid for a listen interface, but the desktop carried the selection as `listenHost` and formatted it with `formatListenHostSelection`, which read as if the desktop still picked a bind address. Rename the serialized selection to `listenSelection` and the formatter to `formatListenInterfaces`. The `--host` spelling now survives only where it belongs, at the CLI and env parse boundary: the bootstrap envelope's own `host` field, which the server parses.
…lver `resolveListenAddresses` matched `family === "IPv4"` exactly, so the desktop carried a `toResolverInterfaces` adapter to rewrite the numeric 4 that some Node builds report. The adapter fixed the symptom for one caller and left the same gap open for every other. Accept both spellings in the resolver and drop the adapter. The server calls the resolver with raw `os.networkInterfaces()` and now gets the same handling for free.
…olver `resolveListenAddresses` calls itself the single home of the fallback policy, but the desktop took its own reading to decide `unavailable`, and took it differently: an explicit `127.0.0.1` counted as asking for more than loopback here and did not there. Return the verdict as `loopbackOnly` and consume it. One policy, one place, and the desktop no longer disagrees with the server about what a selection resolved to.
Core endpoints claimed every non-loopback resolved address as "Local network" with `lan` reachability, so a tailnet address named explicitly in the selection reached clients mislabelled, competing with the correctly labelled private-network endpoint from the Tailscale provider. Core now never claims a tailnet address. Tailnet endpoints come only from the Tailscale provider, and `tailnetResolved` keys off a resolved tailnet address rather than the selected kind, so an explicitly named tailnet address is still advertised instead of being dropped by both sides.
…trings `listenInterfacesEqual` joined both selections to their `--host` spelling and compared the strings, so equality depended on the wire format, and two selections holding the same addresses in a different order read as different. Compare kinds and addresses as sets instead. The desktop's relaunch check now uses that comparison rather than a string difference, so the backend restarts on set inequality, which is what the exposure model actually means.
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket: #7 (parent spec #1, ADR 0003). Rebased onto #6 (multi-bind), so the desktop's loopback base URL and the full-selection envelope are both correct.
Desktop exposure carries a listen-interface selection end to end: contract field beside the derived legacy
mode, persisted setting with one-way migration and dual write, bootstrap envelope carries the selection (never a pre-resolved IP), relaunch on set inequality, Tailscale Serve gated on a resolved tailnet address, advertised endpoints derived from the selection. No new UI; #8 adds the Connections preset control.Deviations from the ticket wording, all deliberate:
modecomes from the effective selection, not the literal "local-only iff exactly {loopback}".{loopback, tailnet, lan}on a machine with no interfaces reportslocal-only; the request stays visible vialistenInterfacesand the "listening on loopback only" warning. Preserves upstream's existing fallback behaviour and test.tailnetkind, so an explicitly listed tailnet address is still advertised with the right label. Side effect: Serve counts as available when an explicit tailnet address is bound without thetailnetkind.listenSelection;listenInterfacesnames the object.Also folded in from review: internal names renamed away from "host"; IPv4 family normalization moved into the shared resolver (
toResolverInterfacesdeleted); desktop reads the loopback-only verdict from the shared resolver instead of re-deriving it; tailnet addresses no longer advertised as "Local network".Verification: 82 tests across contracts exposure, tailscale resolver, desktop exposure, desktop server exposure, desktop settings, and the web atom; typecheck clean on contracts, desktop, tailscale, server. Server files untouched. Follow-up filed for the unreachable loopback fallback branch in the server's listen-address resolver.