default-net Crates.io License

Get default network information
default-net provides a cross-platform API for network interface and gateway.

Supported platform

Usage

Add default-net to your dependencies
toml:Cargo.toml [dependencies] default-net = "0.1.0"

Example

```rust use default_net;

fn main(){ if let Some(defaultinterface) = defaultnet::getdefaultinterface(){ println!("Index {}", defaultinterface.index); println!("Name {}", defaultinterface.name); println!("MAC {:?}", defaultinterface.mac); println!("IPv4 {:?}", defaultinterface.ipv4); println!("IPv6 {:?}", defaultinterface.ipv6); println!("Gateway IP {:?}", defaultinterface.gateway.ip); println!("Gateway MAC {:?}", default_interface.gateway.mac); }else{ println!("Failed to get default interface info"); } } ```

For more details, see examples or doc.