diff --git a/common/src/cli.rs b/common/src/cli.rs index ef06a2c..c56ff51 100644 --- a/common/src/cli.rs +++ b/common/src/cli.rs @@ -141,9 +141,6 @@ pub fn parse_args_config() -> anyhow::Result, bool)> print_usage(&program, opts); return Err(anyhow::anyhow!("parameter -k not found .")); } - #[cfg(target_os = "windows")] - #[cfg(feature = "integrated_tun")] - let tap = matches.opt_present("a"); #[cfg(feature = "integrated_tun")] let device_name = matches.opt_str("nic"); let token: String = matches.opt_get("k").unwrap().unwrap(); @@ -298,7 +295,7 @@ pub fn parse_args_config() -> anyhow::Result, bool)> let config = Config::new( #[cfg(feature = "integrated_tun")] #[cfg(target_os = "windows")] - tap, + false, token, device_id, name, @@ -351,7 +348,6 @@ fn get_description(key: &str, language: &str) -> String { ("-d ", ("设备唯一标识符,不使用--ip参数时,服务端凭此参数分配虚拟ip,注意不能重复", "Device unique identifier, used by the server to allocate virtual IP when --ip parameter is not used, must be unique")), ("-s ", ("注册和中继服务器地址,协议支持使用tcp://和ws://和wss://,默认为udp://", "Registration and relay server address, protocols support using tcp://, ws://, and wss://, default is udp://")), ("-e ", ("stun服务器,用于探测NAT类型,可使用多个地址,如-e stun.miwifi.com -e turn.cloudflare.com", "STUN server for detecting NAT type, can specify multiple addresses, e.g., -e stun.miwifi.com -e turn.cloudflare.com")), - ("-a", ("使用tap模式,默认使用tun模式,使用tap时需要配合'--nic'参数指定tap网卡", "Use tap mode, default is tun mode, specify '--nic' parameter with tap network card")), ("-i ", ("配置点对网(IP代理)时使用,-i 192.168.0.0/24,10.26.0.3表示允许接收网段192.168.0.0/24的数据并转发到10.26.0.3,可指定多个网段", "Used when configuring point-to-point network (IP proxy), -i 192.168.0.0/24,10.26.0.3 allows receiving data from subnet 192.168.0.0/24 and forwarding to 10.26.0.3, specify multiple subnets")), ("-o ", ("配置点对网时使用,-o 192.168.0.0/24表示允许将数据转发到192.168.0.0/24,可指定多个网段", "Used when configuring point-to-point network, -o 192.168.0.0/24 allows forwarding data to 192.168.0.0/24, specify multiple subnets")), ("-w ", ("使用该密码生成的密钥对客户端数据进行加密,并且服务端无法解密,使用相同密码的客户端才能通信", "Encrypt client data with keys generated by this password, server cannot decrypt, clients must use the same password to communicate")), @@ -430,9 +426,7 @@ fn print_usage(program: &str, _opts: Options) { " -e {}", get_description("-e ", &language) ); - #[cfg(target_os = "windows")] - #[cfg(feature = "integrated_tun")] - println!(" -a {}", get_description("-a", &language)); + println!( " -i {}", get_description("-i ", &language) diff --git a/vnt/src/handle/recv_data/server.rs b/vnt/src/handle/recv_data/server.rs index c156d1e..ac86073 100644 --- a/vnt/src/handle/recv_data/server.rs +++ b/vnt/src/handle/recv_data/server.rs @@ -12,6 +12,7 @@ use packet::ip::ipv4; use packet::ip::ipv4::packet::IpV4Packet; use parking_lot::Mutex; use protobuf::Message; +#[cfg(feature = "integrated_tun")] use tun_rs::AbstractDevice; use crate::channel::context::ChannelContext; diff --git a/vnt/src/tun_tap_device/create_device.rs b/vnt/src/tun_tap_device/create_device.rs index a17500e..046d91a 100644 --- a/vnt/src/tun_tap_device/create_device.rs +++ b/vnt/src/tun_tap_device/create_device.rs @@ -8,8 +8,6 @@ use crate::{DeviceConfig, ErrorInfo, ErrorType, VntCallback}; #[cfg(any(target_os = "windows", target_os = "linux"))] const DEFAULT_TUN_NAME: &str = "vnt-tun"; -#[cfg(target_os = "windows")] -const DEFAULT_TAP_NAME: &str = "vnt-tap"; pub fn create_device( config: DeviceConfig, @@ -71,7 +69,7 @@ fn create_device0(config: &DeviceConfig) -> io::Result> { ); tun_config.platform_config(|v| { v.metric(0).ring_capacity(4 * 1024 * 1024); - }) + }); } #[cfg(target_os = "linux")]