From d2b2dfbf1e6743c1deb55a28b6c6c3186306e665 Mon Sep 17 00:00:00 2001 From: lbl8603 <49143209+lbl8603@users.noreply.github.com> Date: Thu, 25 Apr 2024 19:44:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=A4=9A=E4=BD=99=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnt/src/handle/recv_data/client.rs | 17 ++--------------- vnt/src/handle/recv_data/mod.rs | 1 - 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/vnt/src/handle/recv_data/client.rs b/vnt/src/handle/recv_data/client.rs index 8753da0..3b86fc2 100644 --- a/vnt/src/handle/recv_data/client.rs +++ b/vnt/src/handle/recv_data/client.rs @@ -2,7 +2,7 @@ use parking_lot::RwLock; use protobuf::Message; use std::collections::HashMap; use std::io; -use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; +use std::net::{Ipv4Addr, Ipv6Addr}; use std::sync::Arc; use packet::icmp::{icmp, Kind}; @@ -13,7 +13,7 @@ use crate::channel::context::Context; use crate::channel::punch::NatInfo; use crate::channel::{Route, RouteKey}; use crate::cipher::Cipher; -use crate::external_route::{AllowExternalRoute, ExternalRoute}; +use crate::external_route::AllowExternalRoute; use crate::handle::maintain::PunchSender; use crate::handle::recv_data::PacketHandler; use crate::handle::CurrentDeviceInfo; @@ -38,7 +38,6 @@ pub struct ClientPacketHandler { peer_nat_info_map: Arc>>, nat_test: NatTest, route: AllowExternalRoute, - external_route: ExternalRoute, #[cfg(feature = "ip_proxy")] ip_proxy_map: Option, } @@ -51,7 +50,6 @@ impl ClientPacketHandler { peer_nat_info_map: Arc>>, nat_test: NatTest, route: AllowExternalRoute, - external_route: ExternalRoute, #[cfg(feature = "ip_proxy")] ip_proxy_map: Option, ) -> Self { Self { @@ -61,7 +59,6 @@ impl ClientPacketHandler { peer_nat_info_map, nat_test, route, - external_route, #[cfg(feature = "ip_proxy")] ip_proxy_map, } @@ -76,16 +73,6 @@ impl PacketHandler for ClientPacketHandler { context: &Context, current_device: &CurrentDeviceInfo, ) -> io::Result<()> { - let ip = match route_key.addr.ip() { - IpAddr::V4(ip) => Some(ip), - IpAddr::V6(ip) => ip.to_ipv4_mapped(), - }; - if let Some(ip) = ip { - if self.external_route.route(&ip).is_some() { - log::warn!("跳过in路由中的目标 {:?},防止环路 ", route_key); - return Ok(()); - } - } self.client_cipher.decrypt_ipv4(&mut net_packet)?; context .route_table diff --git a/vnt/src/handle/recv_data/mod.rs b/vnt/src/handle/recv_data/mod.rs index d29d4ca..01ff982 100644 --- a/vnt/src/handle/recv_data/mod.rs +++ b/vnt/src/handle/recv_data/mod.rs @@ -88,7 +88,6 @@ impl RecvDataHandler { peer_nat_info_map, nat_test, route, - external_route.clone(), #[cfg(feature = "ip_proxy")] ip_proxy_map, );