Crates.io | ifaces |
lib.rs | ifaces |
version | 0.1.0 |
source | src |
created_at | 2016-05-04 17:57:04.456037 |
updated_at | 2017-03-17 18:29:09.596837 |
description | Rust bindings to retrieve network interface information |
homepage | https://github.com/icorderi/rust-ifaces |
repository | https://github.com/icorderi/rust-ifaces |
max_upload_size | |
id | 4971 |
size | 8,800 |
This library contains functionality to retrieve network interface information on Linux machines.
See examples/ifaces.rs
for an example of printing out network interfaces on a machine:
extern crate ifaces;
fn main () {
for iface in
ifaces::Interface::get_all().unwrap()
.into_iter() {
println!("{}\t{:?}\t{:?}", iface.name, iface.kind, iface.addr);
}
}
On my machine, this prints out:
$ cargo run --example ifaces
lo0 Ipv6 Some(V6([::1]:0))
lo0 Ipv4 Some(V4(127.0.0.1:0))
lo0 Ipv6 Some(V6([fe80::1]:0))
en5 Ipv4 Some(V4(192.168.168.133:0))