Skip to content

Commit

Permalink
Enable debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
josephrhobbs committed Jul 25, 2024
1 parent 3bda434 commit 95ad12b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion examples/access_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ async fn main() {
Ipv4Addr::new(10, 0, 0, 0), // Network address
24, // Network length
).unwrap(),
Default::default() // MAC address management policy (default: public)
);

let result = ap.run().await;
Expand Down
10 changes: 8 additions & 2 deletions proton_wap/src/ap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,15 @@ impl AccessPoint {
// We treat received packets as if they are IPv4 packets
let mut iter = ipv4_packet_iter(&mut rx);

println!("Beginning listener...");

// Continuously iterate through the packets on the receiving line
loop {
println!(" Waiting for packet...");
match iter.next() {
Ok ((packet, addr)) => {
println!(" Received packet: {:#?}", packet);

let (translated_packet, translated_addr) = Self::translate_packet(
&mut nat,
range,
Expand All @@ -136,15 +141,16 @@ impl AccessPoint {

// Send the translated packet
if tx.send_to(translated_packet, translated_addr).is_err() {
println!("Failed to send packet to address {}", addr);
println!(" Failed to send packet to address {}", addr);
}
}
Err (e) => {
// If an error occurs, we can handle it here
println!("Failed to route packet: {:#?}", e);
println!(" Failed to route packet: {:#?}", e);
continue;
}
}
println!();
}
}

Expand Down

0 comments on commit 95ad12b

Please sign in to comment.