Crates.io | ipify-async |
lib.rs | ipify-async |
version | 0.1.1 |
source | src |
created_at | 2020-06-25 02:00:54.315577 |
updated_at | 2020-06-25 02:34:52.928788 |
description | A simple asynchronous library for obtaining your public IP |
homepage | |
repository | |
max_upload_size | |
id | 257744 |
size | 3,621 |
A simple asynchronous library for obtaining your public IP address within Rust code.
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(())
}