#public-ip #obtaining #async

ipify-async

A simple asynchronous library for obtaining your public IP

2 releases

0.1.1 Jun 25, 2020
0.1.0 Jun 25, 2020

#7 in #obtaining

27 downloads per month

MIT license

3KB

ipify-async

A simple asynchronous library for obtaining your public IP address within Rust code.

Example

The following is a simple example using the library while leveraging the tokio runtime.

use ipify_async;

type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync + 'static>>;

#[tokio::main]
async fn main() -> Result<()> {
    let ip = ipify_async::get_ip().await.unwrap().to_string();
    println!("{:?}", ip);
    Ok(())
}

Dependencies

~7–11MB
~228K SLoC