Skip to main content

interfaces

Function interfaces 

Source
pub fn interfaces() -> Result<Vec<Interface>>
Expand description

Every network interface, sorted by index, then name.

for i in sys_lib::net::interfaces()? {
    let mac = i.mac.map(|m| format!("{m} ({:?})", m.kind)).unwrap_or_default();
    println!("{} {:?} up={} {mac}", i.name, i.kind, i.running);
    for a in &i.addresses { println!("    {a}"); }
}

ยงErrors

TooLarge with more than 4 096 interfaces; Os when the OS call fails.