piface

Crates.iopiface
lib.rspiface
version0.1.1
created_at2020-12-03 03:00:06.501487+00
updated_at2021-11-27 23:35:00.195782+00
descriptionAttempts to determine the default route and gets related interface information
homepage
repositoryhttps://github.com/06chaynes/piface
max_upload_size
id319208
size31,459
Christian Haynes (06chaynes)

documentation

README

piface

crates.io Released API docs

This library will attempt to determine the local machine's default route to the internet and pull related info

Examples

use piface::{PrimaryInterface, Result};

fn main() -> Result<()> {
    let iface = PrimaryInterface::load()?;
    println!("{:#?}", iface);
    Ok(())
}

Outputs:

PrimaryInterface {
    name: "en0",
    mac_address: MacAddress("a4:5e:60:b8:1d:2b"),
    default_route: DefaultRoute {
        gateway: Some(
            "192.168.1.1",
        ),
        interface: Some(
            "en0",
        ),
    },
}

License

piface is licensed under both MIT and Apache 2.0

Commit count: 0

cargo fmt