blob: a53a19e7021e6045ea52ac1eb20316fd62ec983a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use anyhow::{Result, Context};
use tokio::sync::broadcast;
use futures::future::try_join_all;
use crate::*;
pub struct Diplonat<'a> {
pub config: config::DiplonatConfig,
pub gateway: igd::aio::Gateway,
pub notif: broadcast::Sender<()>,
pub public_ports: &'a[u16],
adapters: &'a[&'a dyn adapter::Adapter]
}
impl<'a> Diplonat<'a> {
pub async fn new() -> Result<Diplonat<'a>> {
let (tx, _) = broadcast::channel(1);
let ctx = Diplonat {
config: config::load_env().context("Unable to read configuration from environment")?,
gateway: gw::get_gateway().await?,
notif: tx,
public_ports: &[110, 111, 112],
adapters: &[]
};
return Ok(ctx);
}
pub async fn listen(&self) -> Result<()> {
return Ok(());
}
}
|