调整中继模式的逻辑
This commit is contained in:
+14
-9
@@ -103,13 +103,17 @@ impl Vnt {
|
|||||||
stop_manager.clone(),
|
stop_manager.clone(),
|
||||||
config.port_mapping_list.clone(),
|
config.port_mapping_list.clone(),
|
||||||
)?;
|
)?;
|
||||||
let ports = config.ports.as_ref().map_or(vec![0, 0], |v| {
|
let mut ports = config.ports.as_ref().map_or(vec![0, 0], |v| {
|
||||||
if v.is_empty() {
|
if v.is_empty() {
|
||||||
vec![0, 0]
|
vec![0, 0]
|
||||||
} else {
|
} else {
|
||||||
v.clone()
|
v.clone()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if config.use_channel_type.is_only_relay() {
|
||||||
|
//中继模式下只监听一个端口就够了
|
||||||
|
ports.truncate(1);
|
||||||
|
}
|
||||||
//通道上下文
|
//通道上下文
|
||||||
let (context, tcp_listener) = init_context(
|
let (context, tcp_listener) = init_context(
|
||||||
ports,
|
ports,
|
||||||
@@ -327,15 +331,16 @@ pub fn start<Call: VntCallback>(
|
|||||||
client_cipher.clone(),
|
client_cipher.clone(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// 定时地址探测
|
|
||||||
maintain::addr_request(
|
|
||||||
&scheduler,
|
|
||||||
context.clone(),
|
|
||||||
current_device.clone(),
|
|
||||||
server_cipher.clone(),
|
|
||||||
config_info.clone(),
|
|
||||||
);
|
|
||||||
if !context.use_channel_type().is_only_relay() {
|
if !context.use_channel_type().is_only_relay() {
|
||||||
|
// 定时地址探测
|
||||||
|
maintain::addr_request(
|
||||||
|
&scheduler,
|
||||||
|
context.clone(),
|
||||||
|
current_device.clone(),
|
||||||
|
server_cipher.clone(),
|
||||||
|
config_info.clone(),
|
||||||
|
);
|
||||||
// 定时打洞
|
// 定时打洞
|
||||||
maintain::punch(
|
maintain::punch(
|
||||||
&scheduler,
|
&scheduler,
|
||||||
|
|||||||
Reference in New Issue
Block a user