query_external_ip

Crates.ioquery_external_ip
lib.rsquery_external_ip
version0.1.1
sourcesrc
created_at2021-07-04 12:32:24.317149
updated_at2021-07-04 16:47:54.537255
descriptionAsynchronous library for querying the system's external IPv4 and IPv6
homepage
repositoryhttps://github.com/vladvasiliu/query_external_ip.git
max_upload_size
id418567
size8,634
Vlad Vasiliu (vladvasiliu)

documentation

README

Crate Docs

query_external_ip

Get the external IPv4 and IPv6 of the computer.

Example

use query_external_ip::Consensus;

async fn get_ip() {
    match Consensus::get().await {
        Ok(c) => println!("{:#?}", c),
        Err(err) => println!("{}", err),
    }
}

The sources used provide this service for free, so please don't abuse their kindness.

As the external IP doesn't change all that often, I'd recommended waiting at least 10 minutes between queries.

Project status

This is an early beta. It only queries IPs from a bunch of HTTP endpoints.

More tests need to be written.

Contributions, in the form of pull requests and issues are welcome.

Inspiration and similar libraries

This is strongly inspired by Dario Meloni's external-ip.

The main reason for building this new crate was to provide both IPv4 and IPv6 addresses.

There's also rust-public-ip which seems to do the same thing.

License

This program is released under the terms of the BSD 3-Clause license. You may

Commit count: 6

cargo fmt