From b8cbf2cdac8e9da2228bb8a5b7e79b5f2127e7fa Mon Sep 17 00:00:00 2001 From: lbl8603 <49143209+lbl8603@users.noreply.github.com> Date: Sat, 20 Jul 2024 23:26:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=9C=A8=E7=BA=BF=E7=9A=84=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E4=B8=8D=E8=BD=AC=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnt/src/handle/tun_tap/tun_handler.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vnt/src/handle/tun_tap/tun_handler.rs b/vnt/src/handle/tun_tap/tun_handler.rs index ef57181..6b04e22 100644 --- a/vnt/src/handle/tun_tap/tun_handler.rs +++ b/vnt/src/handle/tun_tap/tun_handler.rs @@ -126,7 +126,7 @@ fn broadcast( } return Ok(()); } - if !overflow && relay_ips.len() == 2 { + if !overflow && relay_ips.len() == 1 { // 如果转发的ip数不多就直接发 for peer_ip in relay_ips { //非直连的广播要改变目的地址,不然服务端收到了会再次广播 @@ -256,10 +256,10 @@ pub(crate) fn handle( // 如果是wg客户端则发到vnts转发 let guard = device_map.lock(); if let Some(peer_info) = guard.1.get(&dest_ip) { + if peer_info.status.is_offline() { + return Ok(()); + } if peer_info.wireguard { - if peer_info.status.is_offline() { - return Ok(()); - } drop(guard); send_to_wg(context, &mut net_packet, server_cipher, ¤t_device)?; return Ok(());