From 6bfadfe5b864afe8f9406dca56ba36a508c19384 Mon Sep 17 00:00:00 2001 From: lubeilin <1791778603@qq.com> Date: Mon, 9 Jan 2023 20:30:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- switch/src/handle/punch_handler.rs | 2 +- switch/src/handle/udp_recv_handler.rs | 4 ++-- switch/src/tun_device/mac.rs | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/switch/src/handle/punch_handler.rs b/switch/src/handle/punch_handler.rs index 67b7107..a09b791 100644 --- a/switch/src/handle/punch_handler.rs +++ b/switch/src/handle/punch_handler.rs @@ -249,7 +249,7 @@ async fn res_symmetric_handle_loop( } match tokio::time::timeout(Duration::from_secs(30), receiver.recv()).await { Ok(_) => {} - Err(e) => {} + Err(_e) => {} } loop { tokio::select! { diff --git a/switch/src/handle/udp_recv_handler.rs b/switch/src/handle/udp_recv_handler.rs index 832e66a..3b3e891 100644 --- a/switch/src/handle/udp_recv_handler.rs +++ b/switch/src/handle/udp_recv_handler.rs @@ -32,7 +32,7 @@ pub async fn udp_recv_start( udp: UdpSocket, server_addr: SocketAddr, other_sender: Sender<(SocketAddr, Vec)>, - mut tun_writer: TunWriter, + tun_writer: TunWriter, current_device: CurrentDeviceInfo, stop_fn: F, ) where @@ -275,7 +275,7 @@ fn other_handle( } Protocol::Control => { match ControlPacket::new(net_packet.transport_protocol(), net_packet.payload())? { - ControlPacket::PingPacket(ping) => { + ControlPacket::PingPacket(_ping) => { net_packet.set_transport_protocol(control_packet::Protocol::Pong.into()); udp.send_to(&net_packet.buffer()[..12], peer_addr)?; } diff --git a/switch/src/tun_device/mac.rs b/switch/src/tun_device/mac.rs index a20f1a2..3d9f232 100644 --- a/switch/src/tun_device/mac.rs +++ b/switch/src/tun_device/mac.rs @@ -1,11 +1,11 @@ -use std::io; -use std::io::{Error, Read, Write}; + + use std::net::Ipv4Addr; -use std::os::unix::process::CommandExt; + use std::process::Command; -use bytes::BufMut; -use tun::platform::posix::{Reader, Writer}; + + use tun::Device; use crate::tun_device::{TunReader, TunWriter};