aboutsummaryrefslogtreecommitdiff
path: root/src/gw.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2020-05-09 16:27:54 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2020-05-09 16:27:54 +0200
commit154546a7b4eb36eb1e78fb814c5fe21c6030c2ee (patch)
treeace4cfa4dde3dbf809fd84e0db5e395db2e537fd /src/gw.rs
parent41caf6090ca8b24c162946054c48d59387d21200 (diff)
downloaddiplonat-154546a7b4eb36eb1e78fb814c5fe21c6030c2ee.tar.gz
diplonat-154546a7b4eb36eb1e78fb814c5fe21c6030c2ee.zip
Split logic in multiple files!
Diffstat (limited to 'src/gw.rs')
-rw-r--r--src/gw.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gw.rs b/src/gw.rs
new file mode 100644
index 0000000..f716a3f
--- /dev/null
+++ b/src/gw.rs
@@ -0,0 +1,13 @@
+use igd::aio::Gateway;
+use igd::aio::search_gateway;
+use anyhow::{Result, Context};
+use log::*;
+
+pub async fn get_gateway() -> Result<igd::aio::Gateway> {
+ let gw = search_gateway(Default::default())
+ .await
+ .context("Failed to find gateway")?;
+
+ info!("Gateway: {}", gw);
+ return Ok(gw);
+}