diplonat/src/diplonat.rs

22 lines
440 B
Rust
Raw Normal View History

2020-05-09 14:19:09 +00:00
use anyhow::{Result, Context};
2020-05-09 14:27:54 +00:00
use log::*;
use crate::*;
pub struct DiplonatContext {
pub config: config::DiplonatConfig,
2020-05-09 14:27:54 +00:00
pub gateway: igd::aio::Gateway
}
2020-05-09 14:27:54 +00:00
pub async fn setup() -> Result<DiplonatContext> {
let ctx = DiplonatContext {
2020-05-09 14:19:09 +00:00
config: config::load_env().context("Unable to read configuration from environment")?,
2020-05-09 14:27:54 +00:00
gateway: gw::get_gateway().await?
};
return Ok(ctx);
}
2020-05-09 14:19:09 +00:00
pub fn listen() -> bool {
return true;
}