Find the public IP address of a device
Documentation hosted on docs.rs.
public-ip = "0.2"
#[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");
}
}