From 980f041dd5de4bc359c40262f2b0102817a47c25 Mon Sep 17 00:00:00 2001 From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Sat, 30 Mar 2024 12:36:20 +0800 Subject: [PATCH] PI issues (#59) --- src/platform/android/device.rs | 2 +- src/platform/android/mod.rs | 13 +------------ src/platform/freebsd/device.rs | 2 +- src/platform/freebsd/mod.rs | 13 +------------ 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/platform/android/device.rs b/src/platform/android/device.rs index 624589a4..7b7368a6 100644 --- a/src/platform/android/device.rs +++ b/src/platform/android/device.rs @@ -51,7 +51,7 @@ impl Device { let tun = Fd::new(fd).map_err(|_| std::io::Error::last_os_error())?; Device { - tun: Tun::new(tun, mtu, config.platform_config.packet_information), + tun: Tun::new(tun, mtu, false), } }; diff --git a/src/platform/android/mod.rs b/src/platform/android/mod.rs index 604539d8..4e07ffa7 100644 --- a/src/platform/android/mod.rs +++ b/src/platform/android/mod.rs @@ -21,19 +21,8 @@ use crate::configuration::Configuration; use crate::error::Result; /// Android-only interface configuration. -/// on Android there no packet information exists, so Default is in derive list #[derive(Copy, Clone, Default, Debug)] -pub struct PlatformConfig { - pub(crate) packet_information: bool, -} - -impl PlatformConfig { - pub fn packet_information(&mut self, value: bool) -> &mut Self { - assert!(!value); - self.packet_information = value; - self - } -} +pub struct PlatformConfig; /// Create a TUN device with the given name. pub fn create(configuration: &Configuration) -> Result { diff --git a/src/platform/freebsd/device.rs b/src/platform/freebsd/device.rs index 362dc57b..fe74fec3 100644 --- a/src/platform/freebsd/device.rs +++ b/src/platform/freebsd/device.rs @@ -121,7 +121,7 @@ impl Device { Device { tun_name, - tun: Tun::new(tun, mtu, config.platform_config.packet_information), + tun: Tun::new(tun, mtu, false), ctl, route: None, } diff --git a/src/platform/freebsd/mod.rs b/src/platform/freebsd/mod.rs index 2a929373..a0f77ebd 100644 --- a/src/platform/freebsd/mod.rs +++ b/src/platform/freebsd/mod.rs @@ -23,19 +23,8 @@ use crate::configuration::Configuration; use crate::error::Result; /// FreeBSD-only interface configuration. -/// packet information not exists in FreeBSD, so the `Default` is in `derive` list. #[derive(Copy, Clone, Default, Debug)] -pub struct PlatformConfig { - pub(crate) packet_information: bool, -} - -impl PlatformConfig { - pub fn packet_information(&mut self, value: bool) -> &mut Self { - assert!(!value); - self.packet_information = value; - self - } -} +pub struct PlatformConfig; /// Create a TUN device with the given name. pub fn create(configuration: &Configuration) -> Result {