diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index e7a11a9..cdd7c17 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,27 @@ +use lightyear::transport::io::TransportConfig; +use shared::SERVER_PORT; +use std::net::Ipv4Addr; +use std::net::SocketAddr; +use std::thread; + +mod client; +mod protocol; +mod server; +mod shared; + fn main() { - println!("Hello, world!"); + let (from_server_send, from_server_recv) = crossbeam_channel::unbounded(); + let (to_server_send, to_server_recv) = crossbeam_channel::unbounded(); + + thread::spawn(|| { + let server_addr = SocketAddr::new(Ipv4Addr::new(0, 0, 0, 0).into(), SERVER_PORT); + server::main(TransportConfig::Channels { + channels: [(server_addr, to_server_recv, from_server_send)].to_vec(), + }); + }); + + client::main(TransportConfig::LocalChannel { + recv: from_server_recv, + send: to_server_send, + }); } |