forked from Deuxfleurs/diplonat
23 lines
440 B
Rust
23 lines
440 B
Rust
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;
|
|
}
|
|
}
|