aboutsummaryrefslogtreecommitdiff
path: root/src/diplonat.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/diplonat.rs
parent41caf6090ca8b24c162946054c48d59387d21200 (diff)
downloaddiplonat-154546a7b4eb36eb1e78fb814c5fe21c6030c2ee.tar.gz
diplonat-154546a7b4eb36eb1e78fb814c5fe21c6030c2ee.zip
Split logic in multiple files!
Diffstat (limited to 'src/diplonat.rs')
-rw-r--r--src/diplonat.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/diplonat.rs b/src/diplonat.rs
index 38b2f8a..c209da5 100644
--- a/src/diplonat.rs
+++ b/src/diplonat.rs
@@ -1,18 +1,19 @@
-use igd::Gateway;
use anyhow::{Result, Context};
-
+use log::*;
use crate::*;
pub struct DiplonatContext {
pub config: config::DiplonatConfig,
- //pub gateway: igd::Gateway
+ pub gateway: igd::aio::Gateway
}
-pub fn setup() -> Result<DiplonatContext> {
- return Ok(DiplonatContext {
+pub async fn setup() -> Result<DiplonatContext> {
+ let ctx = DiplonatContext {
config: config::load_env().context("Unable to read configuration from environment")?,
- //gateway: search_gateway(Default::default()).await
- });
+ gateway: gw::get_gateway().await?
+ };
+
+ return Ok(ctx);
}
pub fn listen() -> bool {