default-net 0.22.0

Cross-platform library for network interface and gateway
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// This example shows how to get the default gateway and its properties.

fn main() {
    match default_net::get_default_gateway() {
        Ok(gateway) => {
            println!("Default Gateway");
            println!("\tMAC Address: {}", gateway.mac_addr);
            println!("\tIP Address: {}", gateway.ip_addr);
        }
        Err(e) => {
            println!("Error: {}", e);
        }
    }
}