diff --git a/.vscode/settings.json b/.vscode/settings.json index 8fd1994..2abeb10 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,4 @@ { - "rust-analyzer.cargo.target": "x86_64-pc-windows-gnu" + // "rust-analyzer.cargo.target": "x86_64-pc-windows-gnu" // "rust-analyzer.cargo.features": ["tun"] } \ No newline at end of file diff --git a/src/network/tun_linux.rs b/src/network/tun_linux.rs index 425d467..38d0967 100755 --- a/src/network/tun_linux.rs +++ b/src/network/tun_linux.rs @@ -29,6 +29,7 @@ use super::TunTapPacketHandler; const RESOLV_FILE: &'static str = "/etc/resolv.conf"; const RESOLV_FILE_BACKUP: &'static str = "/etc/resolv.conf.punchnet.bak"; +use crate::network::DNS_IP; // #[link(name = "tuntap", kind="static")] #[link(name = "tuntap")] @@ -223,6 +224,7 @@ impl TunTapPacketHandler for Iface { if let Some(ip) = headers.net { match ip { etherparse::NetHeaders::Ipv4(ipv4, _) => { + if u32::from_be_bytes(ipv4.destination) == DNS_IP { // should send to dns if let Err(e) = edge.udp_sock_for_dns.send_to(&data[14..], format!("{}:15353", edge.server_ip)).await { @@ -476,9 +478,9 @@ impl TunTapPacketHandler for Iface { } if dstip == DNS_IP { // should do the dns request - println!("request for dns"); + // println!("request for dns"); let addr = format!("{}:15353", eee.server_ip); - println!("send dns to {}", addr); + // println!("send dns to {}", addr); if let Err(e) = eee.udp_sock_for_dns.send_to(&data, &addr).await { error!("failed to send request to 15353: {}", e); } diff --git a/src/network/tun_win.rs b/src/network/tun_win.rs index d5979c2..60e2d70 100755 --- a/src/network/tun_win.rs +++ b/src/network/tun_win.rs @@ -309,9 +309,9 @@ impl TunTapPacketHandler for Iface { return Ok(()); } if dstip == DNS_IP { - println!("request for dns"); + // println!("request for dns"); let addr = format!("{}:15353", eee.server_ip); - println!("send dns to {}", addr); + // println!("send dns to {}", addr); if let Err(e) = eee.udp_sock_for_dns.send_to(&data, &addr).await { error!("failed to send request to 15353: {}", e); }