aboutsummaryrefslogtreecommitdiff
path: root/src/diplonat.rs
blob: 3dd4e91867faab6268c3aa2d74b58564b74a2673 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use anyhow::{Result, Context};
use crate::*;

pub struct Diplonat {
  pub config: config::DiplonatConfig,
  pub gateway: igd::aio::Gateway
}

impl Diplonat {
  pub async fn new() -> Result<Self> {
    let ctx = Self {
      config: config::load_env().context("Unable to read configuration from environment")?,
      gateway: gw::get_gateway().await? 
    };

    return Ok(ctx);
  }

  pub fn listen(&self) -> bool {
    return true;
  }
}