aboutsummaryrefslogblamecommitdiff
path: root/src/diplonat.rs
blob: 3dd4e91867faab6268c3aa2d74b58564b74a2673 (plain) (tree)
1
2
3
4
5
6
7
8
                              

             
                     
                                     
                                

 





                                                                                           
 

                   
 


                                
 
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;
  }
}