Initial commit

This commit is contained in:
Quentin 2020-02-12 18:33:10 +01:00
commit 796a8d6f0b
4 changed files with 1850 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
target/

1822
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

12
Cargo.toml Normal file
View file

@ -0,0 +1,12 @@
[package]
name = "diplonat"
version = "0.1.0"
authors = ["Quentin <quentin@deuxfleurs.fr>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
consul = "0.3.0"
igd = { version = "0.10.0", features = ["aio"] }
tokio = "0.2.11"

15
src/main.rs Normal file
View file

@ -0,0 +1,15 @@
use igd::aio::search_gateway;
#[tokio::main]
async fn main() {
let gateway = match search_gateway(Default::default()).await {
Ok(g) => g,
Err(err) => return println!("Faild to find IGD: {}", err),
};
let pub_ip = match gateway.get_external_ip().await {
Ok(ip) => ip,
Err(err) => return println!("Failed to get external IP: {}", err),
};
println!("Our public IP is {}", pub_ip);
}