去除tap
This commit is contained in:
+2
-8
@@ -141,9 +141,6 @@ pub fn parse_args_config() -> anyhow::Result<Option<(Config, Vec<String>, bool)>
|
|||||||
print_usage(&program, opts);
|
print_usage(&program, opts);
|
||||||
return Err(anyhow::anyhow!("parameter -k not found ."));
|
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")]
|
#[cfg(feature = "integrated_tun")]
|
||||||
let device_name = matches.opt_str("nic");
|
let device_name = matches.opt_str("nic");
|
||||||
let token: String = matches.opt_get("k").unwrap().unwrap();
|
let token: String = matches.opt_get("k").unwrap().unwrap();
|
||||||
@@ -298,7 +295,7 @@ pub fn parse_args_config() -> anyhow::Result<Option<(Config, Vec<String>, bool)>
|
|||||||
let config = Config::new(
|
let config = Config::new(
|
||||||
#[cfg(feature = "integrated_tun")]
|
#[cfg(feature = "integrated_tun")]
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
tap,
|
false,
|
||||||
token,
|
token,
|
||||||
device_id,
|
device_id,
|
||||||
name,
|
name,
|
||||||
@@ -351,7 +348,6 @@ fn get_description(key: &str, language: &str) -> String {
|
|||||||
("-d <id>", ("设备唯一标识符,不使用--ip参数时,服务端凭此参数分配虚拟ip,注意不能重复", "Device unique identifier, used by the server to allocate virtual IP when --ip parameter is not used, must be unique")),
|
("-d <id>", ("设备唯一标识符,不使用--ip参数时,服务端凭此参数分配虚拟ip,注意不能重复", "Device unique identifier, used by the server to allocate virtual IP when --ip parameter is not used, must be unique")),
|
||||||
("-s <server>", ("注册和中继服务器地址,协议支持使用tcp://和ws://和wss://,默认为udp://", "Registration and relay server address, protocols support using tcp://, ws://, and wss://, default is udp://")),
|
("-s <server>", ("注册和中继服务器地址,协议支持使用tcp://和ws://和wss://,默认为udp://", "Registration and relay server address, protocols support using tcp://, ws://, and wss://, default is udp://")),
|
||||||
("-e <stun-server>", ("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")),
|
("-e <stun-server>", ("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 <in-ip>", ("配置点对网(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")),
|
("-i <in-ip>", ("配置点对网(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 <out-ip>", ("配置点对网时使用,-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")),
|
("-o <out-ip>", ("配置点对网时使用,-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 <password>", ("使用该密码生成的密钥对客户端数据进行加密,并且服务端无法解密,使用相同密码的客户端才能通信", "Encrypt client data with keys generated by this password, server cannot decrypt, clients must use the same password to communicate")),
|
("-w <password>", ("使用该密码生成的密钥对客户端数据进行加密,并且服务端无法解密,使用相同密码的客户端才能通信", "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 <stun-server> {}",
|
" -e <stun-server> {}",
|
||||||
get_description("-e <stun-server>", &language)
|
get_description("-e <stun-server>", &language)
|
||||||
);
|
);
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
#[cfg(feature = "integrated_tun")]
|
|
||||||
println!(" -a {}", get_description("-a", &language));
|
|
||||||
println!(
|
println!(
|
||||||
" -i <in-ip> {}",
|
" -i <in-ip> {}",
|
||||||
get_description("-i <in-ip>", &language)
|
get_description("-i <in-ip>", &language)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use packet::ip::ipv4;
|
|||||||
use packet::ip::ipv4::packet::IpV4Packet;
|
use packet::ip::ipv4::packet::IpV4Packet;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use protobuf::Message;
|
use protobuf::Message;
|
||||||
|
#[cfg(feature = "integrated_tun")]
|
||||||
use tun_rs::AbstractDevice;
|
use tun_rs::AbstractDevice;
|
||||||
|
|
||||||
use crate::channel::context::ChannelContext;
|
use crate::channel::context::ChannelContext;
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ use crate::{DeviceConfig, ErrorInfo, ErrorType, VntCallback};
|
|||||||
|
|
||||||
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
#[cfg(any(target_os = "windows", target_os = "linux"))]
|
||||||
const DEFAULT_TUN_NAME: &str = "vnt-tun";
|
const DEFAULT_TUN_NAME: &str = "vnt-tun";
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
const DEFAULT_TAP_NAME: &str = "vnt-tap";
|
|
||||||
|
|
||||||
pub fn create_device<Call: VntCallback>(
|
pub fn create_device<Call: VntCallback>(
|
||||||
config: DeviceConfig,
|
config: DeviceConfig,
|
||||||
@@ -71,7 +69,7 @@ fn create_device0(config: &DeviceConfig) -> io::Result<Arc<Device>> {
|
|||||||
);
|
);
|
||||||
tun_config.platform_config(|v| {
|
tun_config.platform_config(|v| {
|
||||||
v.metric(0).ring_capacity(4 * 1024 * 1024);
|
v.metric(0).ring_capacity(4 * 1024 * 1024);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
|
|||||||
Reference in New Issue
Block a user