5 releases

0.2.2 Jan 7, 2022
0.2.1 Jun 15, 2021
0.2.0 Feb 24, 2021
0.1.1 Aug 25, 2020
0.1.0 Jan 19, 2020

#1992 in Network programming

Download history 6779/week @ 2024-03-15 5347/week @ 2024-03-22 4412/week @ 2024-03-29 4870/week @ 2024-04-05 5061/week @ 2024-04-12 6092/week @ 2024-04-19 5157/week @ 2024-04-26 5005/week @ 2024-05-03 5214/week @ 2024-05-10 4945/week @ 2024-05-17 4361/week @ 2024-05-24 3041/week @ 2024-05-31 2685/week @ 2024-06-07 2703/week @ 2024-06-14 3274/week @ 2024-06-21 1633/week @ 2024-06-28

10,811 downloads per month
Used in 20 crates (18 directly)

MIT license

35KB
733 lines

Build Status Crate Docs

rust-public-ip

Find the public IP address of a device
Documentation hosted on docs.rs.

public-ip = "0.2"

Example usage

#[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");
    }
}

lib.rs:

Crate for resolving a devices' own public IP address.

#[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");
    }
}

Dependencies

~1–12MB
~126K SLoC