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

#1429 in Network programming

Download history 3322/week @ 2024-12-01 2741/week @ 2024-12-08 2840/week @ 2024-12-15 1937/week @ 2024-12-22 1369/week @ 2024-12-29 2177/week @ 2025-01-05 3540/week @ 2025-01-12 2692/week @ 2025-01-19 1874/week @ 2025-01-26 3169/week @ 2025-02-02 3286/week @ 2025-02-09 3015/week @ 2025-02-16 2458/week @ 2025-02-23 2336/week @ 2025-03-02 2833/week @ 2025-03-09 2015/week @ 2025-03-16

9,875 downloads per month
Used in 24 crates (22 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
~130K SLoC