| Crates.io | public-ip |
| lib.rs | public-ip |
| version | 0.2.2 |
| created_at | 2020-01-19 11:33:03.436807+00 |
| updated_at | 2022-01-07 18:31:25.375557+00 |
| description | Find the public IP address of a device |
| homepage | https://github.com/avitex/rust-public-ip |
| repository | https://github.com/avitex/rust-public-ip |
| max_upload_size | |
| id | 200074 |
| size | 60,112 |
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");
}
}