parent
963631ff96
commit
fd3c85fccd
|
@ -22,7 +22,7 @@ pub struct Opt {
|
|||
#[structopt (long)]
|
||||
listen_addr: Option <String>,
|
||||
#[structopt (long)]
|
||||
tcp_listen_addr: Option <String>,
|
||||
tcp_listen_port: Option <u16>,
|
||||
}
|
||||
|
||||
pub async fn main (opt: Opt) -> anyhow::Result <()>
|
||||
|
@ -115,9 +115,37 @@ pub async fn main (opt: Opt) -> anyhow::Result <()>
|
|||
|
||||
debug! ("Serving HTTP on {:?}", http_addr);
|
||||
|
||||
task_quic_server.await??;
|
||||
task_http_server.await??;
|
||||
task_direc_server.await??;
|
||||
let task_tcp_over_udp_server = if let Some (tcp_listen_port) = opt.tcp_listen_port {
|
||||
tokio::spawn (async move {
|
||||
let cfg = udp_over_tcp::server::Config {
|
||||
tcp_port: tcp_listen_port,
|
||||
udp_port: listen_addr.port (),
|
||||
};
|
||||
udp_over_tcp::server::main (cfg).await
|
||||
})
|
||||
}
|
||||
else {
|
||||
tokio::spawn (async move {
|
||||
loop {
|
||||
tokio::time::sleep (Duration::from_secs (3_600)).await;
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
tokio::select! {
|
||||
_val = task_quic_server => {
|
||||
eprintln! ("QUIC relay server exited, exiting");
|
||||
},
|
||||
_val = task_http_server => {
|
||||
eprintln! ("HTTP server exited, exiting");
|
||||
},
|
||||
_val = task_direc_server => {
|
||||
eprintln! ("PTTH_DIREC server exited, exiting");
|
||||
},
|
||||
_val = task_tcp_over_udp_server => {
|
||||
eprintln! ("tcp_over_udp server exited, exiting");
|
||||
}
|
||||
}
|
||||
|
||||
Ok (())
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
pub mod client;
|
||||
pub mod server;
|
||||
|
||||
mod loops;
|
Loading…
Reference in New Issue