public-ip 0.2.2

Find the public IP address of a device
Documentation
1
2
3
4
5
6
7
8
9
#[tokio::main]
async fn main() {
    // Attempt to get an IP address and print it.
    if let Some(ip) = public_ip::addr().await {
        println!("public ip address: {:?}", ip);
    } else {
        println!("couldn't get an IP address");
    }
}