if-addrs

Crates.ioif-addrs
lib.rsif-addrs
version0.13.3
sourcesrc
created_at2020-08-10 06:32:55.747458
updated_at2024-08-19 11:17:06.460455
descriptionReturn interface IP addresses on Posix and windows systems
homepage
repositoryhttps://github.com/messense/if-addrs
max_upload_size
id274948
size58,771
messense (messense)

documentation

README

if-addrs

https://crates.io/crates/if-addrs

Overview

Retrieve network interface info for all interfaces on the system:

// List all of the machine's network interfaces
for iface in if_addrs::get_if_addrs().unwrap() {
    println!("{:#?}", iface);
}

Get notifications for changes in network interfaces:

let mut notifier = if_addrs::IfChangeNotifier::new().unwrap();
loop {
    if let Ok(details) = notifier.wait(None) {
        println!("{:#?}", details);
    }
}

License

This SAFE Network library is dual-licensed under the Modified BSD (LICENSE-BSD https://opensource.org/licenses/BSD-3-Clause) or the MIT license (LICENSE-MIT http://opensource.org/licenses/MIT) at your option.

Contribution

Copyrights in the SAFE Network are retained by their contributors. No copyright assignment is required to contribute to this project.

Commit count: 239

cargo fmt