+ game protocol

This commit is contained in:
Wiktor Mazur
2019-08-01 18:46:52 +02:00
parent 761e088423
commit 6b7d1e2905
5 changed files with 82 additions and 4 deletions
+15 -2
View File
@@ -1,16 +1,29 @@
extern crate bytes;
extern crate packet_sniffer;
extern crate protocol16;
use std::sync::mpsc::{Sender, Receiver};
use std::sync::mpsc;
use packet_sniffer::UdpPacket;
mod protocol;
fn main() {
let (tx, rx): (Sender<UdpPacket>, Receiver<UdpPacket>) = mpsc::channel();
packet_sniffer::receive(tx);
loop {
println!("{:?}", rx.recv());
if let Ok(packet) = rx.recv() {
if packet.destination_port != 5056 && packet.source_port != 5056 {
continue;
}
protocol::decode(&packet.payload);
}
}
}
}