1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
pub mod have_file;
pub mod i_have_code;
pub mod ip_for_code;
pub mod recieving_ip;
pub mod you_have_file;
pub enum ClientMsg {
HaveFile(have_file::HaveFile),
IHaveCode(i_have_code::IHaveCode),
HolePunch,
None,
}
pub enum ServerMsg {
YouHaveFile(you_have_file::YouHaveFile),
IpForCode(ip_for_code::IpForCode),
Recieving(recieving_ip::RecievingIp),
}
pub trait Message {
fn to_raw(&self) -> Vec<u8>;
fn from_raw(raw: &[u8]) -> Result<Self, &'static str>
where
Self: Sized;
}