aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2020-02-12 18:33:10 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2020-02-12 18:33:10 +0100
commit796a8d6f0bb47da4c888cbac7761b60609c50893 (patch)
tree9c4751d2d9fee1196f1a7dc4a86fe5c1454c9778 /src
downloaddiplonat-796a8d6f0bb47da4c888cbac7761b60609c50893.tar.gz
diplonat-796a8d6f0bb47da4c888cbac7761b60609c50893.zip
Initial commit
Diffstat (limited to 'src')
-rw-r--r--src/main.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..a676662
--- /dev/null
+++ b/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);
+}