2023-03-19 19:06:29 +01:00
|
|
|
mod entry;
|
2023-03-19 17:13:49 +01:00
|
|
|
mod handshake;
|
2023-03-19 19:29:02 +01:00
|
|
|
mod stdin_reader;
|
2023-03-19 17:13:49 +01:00
|
|
|
|
2023-03-19 19:06:29 +01:00
|
|
|
use entry::Entry;
|
2023-03-19 19:29:02 +01:00
|
|
|
use stdin_reader::StdinReader;
|
2023-03-19 19:06:29 +01:00
|
|
|
|
|
|
|
const DEFAULT_BUFF_SIZE: usize = 1024;
|
|
|
|
|
2023-03-19 14:59:32 +01:00
|
|
|
fn main() {
|
2023-03-19 19:29:02 +01:00
|
|
|
let mut reader = StdinReader::new();
|
|
|
|
handshake::read_config(&mut reader);
|
2023-03-19 17:13:49 +01:00
|
|
|
handshake::register_filter();
|
2023-03-19 19:06:29 +01:00
|
|
|
loop {
|
2023-03-19 19:29:02 +01:00
|
|
|
match Entry::from_bytes(&reader.read_line()) {
|
2023-03-19 19:06:29 +01:00
|
|
|
Ok(entry) => {
|
|
|
|
if !entry.is_end_of_message() {
|
|
|
|
println!("Debug: {entry:?}");
|
|
|
|
} else {
|
|
|
|
println!("Debug: end of message: {entry:?}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Err(err) => {
|
|
|
|
eprintln!("{err}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|