netifs

Crates.ionetifs
lib.rsnetifs
version0.3.0
sourcesrc
created_at2020-06-05 21:20:20.203386
updated_at2020-06-12 14:01:31.16038
descriptionCross-platform utility library to enumerate local network interfaces.
homepagehttps://github.com/mensi/netifs-rs
repositoryhttps://github.com/mensi/netifs-rs
max_upload_size
id250462
size39,661
Manuel Stocker (mensi)

documentation

README

netifs

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.

Usage

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);
        }
    }
}
Commit count: 3

cargo fmt