#ip #public-ip #obtaining #async #ip-address

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

#6 in #obtaining

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

~8–12MB
~212K SLoC