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

#1950 in Network programming

Download history 5425/week @ 2024-08-03 6719/week @ 2024-08-10 3465/week @ 2024-08-17 3645/week @ 2024-08-24 4206/week @ 2024-08-31 5943/week @ 2024-09-07 3641/week @ 2024-09-14 2776/week @ 2024-09-21 2849/week @ 2024-09-28 2963/week @ 2024-10-05 3553/week @ 2024-10-12 3114/week @ 2024-10-19 2969/week @ 2024-10-26 3480/week @ 2024-11-02 2527/week @ 2024-11-09 2935/week @ 2024-11-16

12,435 downloads per month
Used in 21 crates (19 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–11MB
~125K SLoC