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

#1809 in Network programming

Download history 3089/week @ 2024-06-19 2735/week @ 2024-06-26 2806/week @ 2024-07-03 4487/week @ 2024-07-10 5748/week @ 2024-07-17 6234/week @ 2024-07-24 6355/week @ 2024-07-31 6319/week @ 2024-08-07 4216/week @ 2024-08-14 3623/week @ 2024-08-21 3948/week @ 2024-08-28 5919/week @ 2024-09-04 4606/week @ 2024-09-11 2453/week @ 2024-09-18 3045/week @ 2024-09-25 2208/week @ 2024-10-02

13,075 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
~118K SLoC