A user's computer has a static public address from its ISP on the
network card itself (203.236.50.70) as well as a private one
(10.77.70.2). Settings › Network & sharing listed 203.236.50.70 as the
gateway's address but only 10.77.70.2 under "Open magpie in a browser",
and they asked why the two differ. The gateway's list
(gateway.LANURLs) took every IPv4 address on an interface that is up;
the page's (gui.LANAddrs) took private ones only, through
net.InterfaceAddrs, down interfaces included. The page server in LAN
mode listens on 0.0.0.0, so the public address serves it too.
Now one list makes both: gateway.LANHosts, every interface that is up,
IPv4, not loopback or link-local, in the interfaces' order.
gui.LANAddrs (and so NetworkLinks, the CLI's `magpie web` and daemon
links) returns it, MAGPIE_PUBLIC_URL's host still first when set.
The page's links now also show a CGNAT/Tailscale 100.64.x address, as
the gateway's already did.
Run, on mote: go vet ./internal/gateway ./internal/gui ./internal/cli;
GOOS=windows go vet ./internal/gateway ./internal/gui; GOOS=linux go vet
./internal/gateway; go test -run
"LAN|Lan|URL|TLS|Public|Network|Share|Allow|Container"
./internal/gateway ok; go test ./internal/gui ./internal/cli: cli ok,
gui ok but for TestMainWindowCorners/macOS_26_SDK, #3949 (macOS 27,
not about addresses). On xiaomi-gpu (Windows): the gateway's LANHosts,
PublicURL and TLS address tests ok.
New: TestLANHostsKeepAPublicAddress (a stubbed public, private, CGNAT,
link-local, loopback and IPv6 address) and
TestNetworkLinksAtTheGatewaysHosts.
Broken by hand: LANHosts keeping private addresses only, as the page's
list did, turns TestLANHostsKeepAPublicAddress red (got [10.77.70.2]).
Not run: GOOS=linux vet of internal/gui (needs cgo; the WSL box lacks
gtk4 and webkitgtk-6.0 headers); not tried on the reporter's machine.