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

#1930 in Network programming

Download history 5199/week @ 2023-12-14 3881/week @ 2023-12-21 3711/week @ 2023-12-28 4842/week @ 2024-01-04 4869/week @ 2024-01-11 5401/week @ 2024-01-18 5865/week @ 2024-01-25 5557/week @ 2024-02-01 5173/week @ 2024-02-08 5614/week @ 2024-02-15 6341/week @ 2024-02-22 7023/week @ 2024-02-29 6349/week @ 2024-03-07 6563/week @ 2024-03-14 5853/week @ 2024-03-21 3393/week @ 2024-03-28

23,256 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–13MB
~134K SLoC