Skip to main content

Crate netifs

Crate netifs 

Source
Expand description

Utility create to enumerate local network interfaces.

This crate was tested on Windows 10 and Ubuntu 19.10

§Example

use netifs::get_interfaces;

fn main() {
    for interface in get_interfaces().expect("Getting interfaces failed") {
        println!("{}", interface.name);
        if let Some(mac) = interface.mac_address {
            println!("\tMAC: {}", mac.to_hex_string());
        }
        for ip in interface.ip_addresses {
            println!("\tIP: {}", ip);
        }
    }
}

Structs§

Interface
Represents a network interface.

Functions§

get_interfaces
Retrieve the network interfaces.