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

#1492 in Network programming

Download history 2938/week @ 2024-11-16 2676/week @ 2024-11-23 3262/week @ 2024-11-30 2813/week @ 2024-12-07 2783/week @ 2024-12-14 1907/week @ 2024-12-21 1453/week @ 2024-12-28 2125/week @ 2025-01-04 3543/week @ 2025-01-11 2657/week @ 2025-01-18 1914/week @ 2025-01-25 3013/week @ 2025-02-01 3373/week @ 2025-02-08 3012/week @ 2025-02-15 2502/week @ 2025-02-22 1913/week @ 2025-03-01

11,326 downloads per month
Used in 23 crates (21 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
~128K SLoC