Expand description
Bind-address resolution for trusty-console.
Why: The console needs to be reachable from tailnet clients across restarts
without manual --http 0.0.0.0:7788 overrides. This module centralises all
bind-address logic — env-var defaults, --tailscale flag handling, and
Tailscale-IPv4 detection — behind a clean, mockable boundary so the
resolution logic can be unit-tested without a real tailnet.
What: Exports resolve_bind_addrs, which returns the ordered list of
SocketAddrs the server should bind; and detect_tailscale_ipv4, which
shells out to tailscale ip -4 (or accepts an injected command for tests).
Test: tests module below; no real tailnet required.
Enums§
- Bind
Mode - How the server should bind its listeners.
Functions§
- bind_
listener - Bind a TCP listener, logging and returning a descriptive error on failure.
- detect_
tailscale_ ipv4 - Detect the machine’s Tailscale IPv4 address by running
tailscale ip -4. - port_
from_ addr - Parse the port from an explicit bind address string, falling back to
default. - resolve_
bind_ addrs - Resolve the list of
SocketAddrs to bind based onmodeandport.