Crates.io | netifs |
lib.rs | netifs |
version | 0.3.0 |
source | src |
created_at | 2020-06-05 21:20:20.203386 |
updated_at | 2020-06-12 14:01:31.16038 |
description | Cross-platform utility library to enumerate local network interfaces. |
homepage | https://github.com/mensi/netifs-rs |
repository | https://github.com/mensi/netifs-rs |
max_upload_size | |
id | 250462 |
size | 39,661 |
This is a simple rust wrapper on top of libc/winapi to enumerate network interfaces. On Windows, an MSVC toolchain is necessary to build.
Loopback interface and IPv6 support is present in both platform specific implementations.
An small example program is provided in netifs-cli:
use netifs::get_interfaces;
fn main() {
for interface in get_interfaces().expect("Getting interfaces failed") {
println!("{}", interface.display_name);
if let Some(mac) = interface.mac_address {
println!("\tMAC: {}", mac.to_hex_string());
}
for ip in interface.ip_addresses {
println!("\tIP: {}", ip);
}
}
}