aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 4df32c86b608c36626aa5195c5d954b1a81f4e61 (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
32
33
34
35
mod messages;
mod environment;
mod consul;
mod consul_actor;
mod igd_actor;
mod diplonat;

//use std::net::SocketAddrV4;
//use std::collections::HashMap;
//use igd::PortMappingProtocol;
use log::*;
use diplonat::Diplonat;

#[tokio::main]
async fn main() {
  pretty_env_logger::init();
  info!("Starting Diplonat");
  
  let mut diplo = Diplonat::new().await.expect("Setup failed");
  diplo.listen().await.expect("A runtime error occured");

/*
    let gateway = match search_gateway(Default::default()).await {
        Ok(g) => g,
        Err(err) => return println!("Faild to find IGD: {}", err),
    };

    let service = format!("{}:{}", config.private_ip, 1234);
    let service: SocketAddrV4 = service.parse().expect("Invalid socket address");
    match gateway.add_port(PortMappingProtocol::TCP, 1234, service, config.expiration_time, "diplonat").await {
        Ok(_) => (),
        Err(e) => return println!("Unable to insert port 1234: {}", e),
    };
    */
}