summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index d45fe8a..b5c4e69 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,13 +1,11 @@
use std::io;
use std::net::{SocketAddr, ToSocketAddrs};
-
use std::time::{Duration, SystemTime, SystemTimeError};
use clap::{arg, Parser};
use tokio::net::UdpSocket;
use tracing::{debug, error};
-
use crate::Destination::{Address, SockAddr};
const TTL: Duration = Duration::from_secs(300);
@@ -52,8 +50,8 @@ async fn main() {
let local = args.local.parse().expect("failed to parse local address");
let mut sendto = Destination::None;
let args_sendto: String;
- if let Some(s) = args.sendto {
- args_sendto = s;
+ if let Some(s) = &args.sendto {
+ args_sendto = s.clone();
sendto = Address(&args_sendto);
}
let mut addr_sendto: Option<SocketAddr> = None;
@@ -71,8 +69,9 @@ async fn main() {
i = 0;
}
}
- if sendto == Destination::None && addr != local {
- // assume the packet is coming from target
+ if args.sendto == None && addr != local {
+ // sendto is not defined by user and is determined dynamically
+ // we simply assume the last packet's sender is the target
// update missing sendto parameter
sendto = SockAddr(addr);
}