Advertise tailnet and public routes in server discovery
The mDNS record now carries ts= (tailnet IPv4 addresses) and public= (the installer's HTTPS origin from PIPELINES_WEB_PUBLIC_URL) in TXT, and browse, the discover_servers RPC and /discovery return every route to a machine as addresses with kinds lan, tailscale and public. Endpoint stays the LAN route for older clients. Unsafe ts/public values are dropped.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# Discovery advertises every route to a machine
|
||||
|
||||
`internal/discovery.Plan` adds two optional TXT keys to the `_pipelines._tcp`
|
||||
record: `ts=<ipv4>[,<ipv4>]` lists the host's tailnet addresses
|
||||
(100.64.0.0/10, found on any up interface, including the tunnel interfaces
|
||||
`LANAddresses` skips) and `public=<http(s)://host[:port]>` is the TLS front's
|
||||
origin for the same web proxy, taken from `PIPELINES_WEB_PUBLIC_URL`, which the
|
||||
installer already exports to the server process. `PublicOrigin` accepts only a
|
||||
bare origin: no credentials, path, query or fragment.
|
||||
|
||||
`Browse` returns `FoundServer.Addresses`, every route to the same machine with
|
||||
`Kind` `lan` (the mDNS A record and advertised port), `tailscale` (same scheme
|
||||
and port on each tailnet IP) or `public` (`wss://` for an https origin, path
|
||||
`/connect`). `Endpoint` stays the LAN route for older clients. The
|
||||
`discover_servers` RPC and `/discovery` (and the proxy's `/api/discovery`,
|
||||
which forwards the body verbatim) carry the same `addresses` array.
|
||||
|
||||
A Tailscale HTTPS certificate covers only the MagicDNS name, so there is no
|
||||
`wss://<tailnet ip>` route; the tailnet IP route is `ws://` on the plain web
|
||||
port, encrypted by WireGuard.
|
||||
|
||||
Tests: `TestPlanAdvertisesTailnetAndPublicRoutes`,
|
||||
`TestBrowseListsEveryRouteToTheSameMachine` (unsafe `ts`/`public` values are
|
||||
dropped). `go test ./internal/discovery ./internal/server ./internal/protocol`
|
||||
passes.
|
||||
Reference in New Issue
Block a user