diplonat/src/main.rs

37 lines
1 KiB
Rust
Raw Normal View History

2020-05-22 10:25:44 +00:00
mod messages;
2020-05-21 21:04:21 +00:00
mod consul;
2020-05-22 09:34:12 +00:00
mod consul_actor;
2020-02-12 17:33:10 +00:00
2020-05-09 14:50:38 +00:00
//use std::net::SocketAddrV4;
//use std::collections::HashMap;
//use igd::PortMappingProtocol;
use log::*;
2020-05-22 10:29:55 +00:00
use consul_actor::*;
2020-05-09 14:50:38 +00:00
2020-02-12 17:33:10 +00:00
#[tokio::main]
async fn main() {
2020-05-22 10:29:55 +00:00
pretty_env_logger::init();
info!("Starting Diplonat");
2020-05-21 21:04:21 +00:00
/*
2020-05-09 14:50:38 +00:00
let diplo = Diplonat::new().await.expect("Setup failed");
2020-05-21 13:22:45 +00:00
diplo.listen().await.expect("A runtime error occured");
2020-05-21 21:04:21 +00:00
*/
2020-05-22 10:29:55 +00:00
let mut ca = ConsulActor::new("http://127.0.0.1:8500", "lheureduthe");
ca.listen().await.expect("Oooooops");
2020-05-21 21:04:21 +00:00
/*
2020-02-12 17:33:10 +00:00
let gateway = match search_gateway(Default::default()).await {
Ok(g) => g,
Err(err) => return println!("Faild to find IGD: {}", err),
};
2020-02-12 23:17:23 +00:00
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),
2020-02-12 17:33:10 +00:00
};
*/
2020-02-12 17:33:10 +00:00
}