From 2e507f1a9d4a6bbe17c25951a43d1648b1ef210b Mon Sep 17 00:00:00 2001 From: lubeilin <1791778603@qq.com> Date: Sun, 27 Aug 2023 17:51:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8D=E5=8A=A0=E5=AF=86?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=89=93=E6=B4=9E=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnt/src/handle/punch_handler.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vnt/src/handle/punch_handler.rs b/vnt/src/handle/punch_handler.rs index b2876819..29128322 100644 --- a/vnt/src/handle/punch_handler.rs +++ b/vnt/src/handle/punch_handler.rs @@ -113,8 +113,8 @@ async fn start_punch_( if count > 2 { break; } - let buf = punch_packet(client_cipher, current_device.virtual_ip(), &nat_info, info.virtual_ip)?; - let _ = sender.send_main(&buf, current_device.connect_server).await; + let packet = punch_packet(client_cipher, current_device.virtual_ip(), &nat_info, info.virtual_ip)?; + let _ = sender.send_main(packet.buffer(), current_device.connect_server).await; } tokio::time::sleep(sleep_time).await; Ok(()) @@ -125,7 +125,7 @@ pub fn punch_packet( virtual_ip: Ipv4Addr, nat_info: &NatInfo, dest: Ipv4Addr, -) -> crate::Result> { +) -> crate::Result>> { let mut punch_reply = PunchInfo::new(); punch_reply.reply = false; punch_reply.public_ip_list = nat_info @@ -148,5 +148,5 @@ pub fn punch_packet( net_packet.set_destination(dest); net_packet.set_payload(&bytes)?; client_cipher.encrypt_ipv4(&mut net_packet)?; - Ok(net_packet.into_buffer()) + Ok(net_packet) }