Repository navigation
Closed
Labels
ready-for-agentFully specified, ready for an AFK agent
Description
Parent
Spec: #1 — Exposure as a set of listen interfaces (bind-hosts lane). Governing ADR: 0003.
What to build
The vocabulary every later ticket consumes, as pure code with no callers yet.
In the contracts package (no dependencies):
- A
listenInterfacesselection schema — a set of kinds fromloopback | tailnet | lanplus an optional IPv4 address list — normalized soloopbackis always present. - Exposure preset derivation and its inverse:
local-only= {loopback};tailscale-only= {loopback, tailnet};lan= {loopback, tailnet, lan}; anything else =custom. - Legacy mapping helpers:
local-only→ {loopback};network-accessible→ thelanpreset; the derived legacy mode islocal-onlyiff the selection is exactly {loopback} with no addresses.
In the tailscale package, beside isTailscaleIpv4Address: the resolver — a pure function taking a selection and an injectable network-interface map and returning { addresses, warnings }. No I/O, no tailscale CLI. It is the single home of the fallback policy.
Resolution rules (IPv4 only in v1):
loopback→127.0.0.1tailnet→ every non-internal IPv4 in the Tailscale CGNAT rangelan→ every non-internal IPv4 that is not a tailnet address- explicit addresses → included only if present on some interface (or loopback); a missing one is skipped with a warning naming it
tailnetselected but absent → warning; continue with whatever else resolved- selection had non-loopback kinds or addresses but the result is loopback only → an additional "listening on loopback only" warning
- deduplicated; ordered loopback → tailnet → lan → explicit
Acceptance criteria
- Schema rejects unknown kinds and non-IPv4 strings; decoding an input without
loopbackyields a selection that contains it. - Preset derivation and its inverse round-trip for the three named presets; any other selection derives to
custom. - Legacy mapping helpers behave as specified above.
- Resolver unit tests with synthetic interface maps cover every rule: multi-NIC
lan, CGNAT detection, tailnet-missing warning, explicit-missing warning, loopback-only warning, dedupe and order, IPv6 and internal entries ignored. - No production caller yet; typecheck and lint clean.
- Names use the fork glossary (exposure, listen interface, exposure preset); no "network access" / "bind host" / "mode" in new identifiers.
Blocked by
- None — can start immediately.
Metadata
Metadata
Assignees
Labels
ready-for-agentFully specified, ready for an AFK agent
Activity
t3 serve --host tailnetbinds the tailnet address only #5Merge pull request #11 from Khang5687/feat/listen-selection
Khang5687 commentedon Sep 6, 2026
Merged into fork-main via #11