fix: fixed weird issues with querying routes

this just involved a better understanding of the data
types provided by libnl and some refactoring to make querying
as a user of the libnl library easier
This commit is contained in:
Andrew Rioux
2023-05-01 09:15:15 -04:00
parent be5772fa23
commit c16bf366b7
10 changed files with 285 additions and 28 deletions

View File

@@ -1,3 +1,19 @@
fn main() {
println!("Hello, world!");
use std::net::UdpSocket;
fn main() -> anyhow::Result<()> {
let input = UdpSocket::bind("0.0.0.0:54248")?;
loop {
let mut buf = [0u8; 4];
let Ok((amount, src)) = input.recv_from(&mut buf[..]) else { continue; };
if amount != 4 {
continue;
}
println!("Received packet: {}", i32::from_be_bytes(buf));
let Ok(_) = input.send_to(&buf, src) else { continue; };
}
}