Browse Source

Initial commit

main
Quentin 1 year ago
commit
796a8d6f0b
  1. 1
      .gitignore
  2. 1822
      Cargo.lock
  3. 12
      Cargo.toml
  4. 15
      src/main.rs

1
.gitignore

@ -0,0 +1 @@
target/

1822
Cargo.lock
File diff suppressed because it is too large
View File

12
Cargo.toml

@ -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

@ -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);
}
Loading…
Cancel
Save