Skip to main content

Module lan_ip

Module lan_ip 

Source
Expand description

LAN IP address detection for the reverse proxy.

Detects the local IPv4 address used for the default route by opening a UDP “connection” to a public address (1.1.1.1:53). No data is sent; the OS routing table determines which local address to use, and we read it back via socket.local_addr().

On Unix, falls back to interface enumeration via nix::ifaddrs when the UDP probe fails (e.g. no route to the internet). On Windows, only the UDP probe is available.

Functions§

detect_lan_ip
Detect the LAN IPv4 address of the default outbound route.
detect_lan_ip_if_changed
Detect LAN IP, returning None if it hasn’t changed since last.