INNER CODE UNIT · Rust
has_usable_ipv4
domcyrus/rustnet · crates/rustnet-capture/src/lib.rs:91
fn has_usable_ipv4(device: &Device) -> bool {
device.addresses.iter().any(|addr| match &addr.addr {
std::net::IpAddr::V4(v4) => {
!v4.is_link_local() && !v4.is_loopback() && !v4.is_unspecified()
}
std::net::IpAddr::V6(_) => false,
})
}
fn has_excluded_name_prefix(name: &str) -> bool {
EXCLUDED_NAME_PREFIXES
.iter()
.any(|prefix| name.starts_with(prefix))
}
/// Case-insensitive check of the device description against `markers`.
fn desc_contains_any(device: &Device, markers: &[&str]) -> bool {
let desc_lower = device