Skip to main content

Module subnet

Module subnet 

Source
Expand description

Client-side LAN facts: the client’s own IPv4 and the hosts of its /24.

Functions§

hosts_in_slash24
The 254 usable host addresses of base’s /24 (.1–.254), network and broadcast excluded.
local_ipv4
The client’s primary IPv4, via the routing table — bind a UDP socket and “connect” it to a public address (no packet is sent; this just selects the default-route interface), then read the local address. None if there is no usable route (e.g. an isolated host); the caller then needs --subnet.