pub fn interfaces() -> Vec<(String, Ipv4Addr)>Expand description
The up, non-loopback IPv4 interfaces of this machine, ranked, with their names. What is
left out is what a remote runtime could not dial anyway: an interface that is down,
loopback, unspecified, or link-local. The order is the advertising preference — a
physical or overlay interface before a container or VM bridge — because only the first
MAX_ENDPOINTS survive into an advertisement and a bridge address is the one a peer
is least likely to reach.
use majordomus_cli::mesh::address::interfaces;
// whatever this machine has, every address here is one a peer could be told to dial
for (name, ip) in interfaces() {
assert!(!ip.is_loopback() && !ip.is_unspecified(), "{name} advertises {ip}");
}