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



                                
              
 

                 
                              
                               
  
                                                             
                                                           
  

                                                                             
                          

                                                                              
 
  




                                                                  


                                                                                                               

                                                                       
      
      
 
mod messages;
mod consul;
mod consul_actor;

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

#[tokio::main]
async fn main() {
    pretty_env_logger::init();
    info!("Starting Diplonat");
/*
    let diplo = Diplonat::new().await.expect("Setup failed");
    diplo.listen().await.expect("A runtime error occured");
*/
    let mut c = Consul::new("http://127.0.0.1:8500");
    let cn = c.watch_node("lheureduthe").await.expect("Failed to fetch API");
    println!("{:#?}", cn);
    let cn2 = c.watch_node("lheureduthe").await.expect("Failed to fetch API");
    println!("{:#?}", cn2);

/*
    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),
    };
    */
}