/* To test manually, run this 3 commands: - Terminal A: `nc -l -u -p 9502` - Terminal B: `cargo run -p udp_over_tcp` - Terminal C: `nc -p 9500 -u 127.0.0.1 9501` Terminals A and C should be connected through the UDP-over-TCP connection */ use tokio::{ runtime, spawn, }; mod client; mod loops; mod server; // The ephemeral UDP port that the PTTH_QUIC client will bind const PORT_0: u16 = 9500; // The well-known UDP port that the UDP-over-TCP client will bind // The PTTH_QUIC client must connect to this instead of the real relay address const PORT_1: u16 = 9501; // The well-known TCP port that the UDP-over-TCP server will bind const PORT_2: u16 = 9502; // The well-known UDP port that the PTTH_QUIC relay will bind const PORT_3: u16 = 9502; fn main () -> anyhow::Result <()> { let rt = runtime::Runtime::new ()?; rt.block_on (async_main ())?; Ok (()) } async fn async_main () -> anyhow::Result <()> { let server_cfg = server::Config { tcp_port: PORT_2, udp_port: PORT_3, }; let server_task = spawn (server::main (server_cfg)); let client_cfg = client::Config { udp_eph_port: PORT_0, udp_local_server_port: PORT_1, tcp_server_port: PORT_2, }; let client_task = spawn (client::main (client_cfg)); tokio::select! { _val = client_task => { println! ("Client exited, exiting"); }, _val = server_task => { println! ("Server exited, exiting"); }, } Ok (()) }