使用读写锁简化操作,增加延迟优先选项
This commit is contained in:
@@ -82,6 +82,8 @@
|
||||
取值0~65535,指定本地监听的端口,默认取随机端口
|
||||
### --cmd
|
||||
开启交互式命令,开启后可以直接在窗口下输入命令,如需后台运行请勿开启
|
||||
### --first_latency
|
||||
优先使用低延迟通道,默认情况下优先使用p2p通道,某些情况下可能p2p比客户端中继延迟更高,可使用此参数进行优化传输
|
||||
### --no-proxy
|
||||
关闭内置的ip代理,内置的代理较为简单,而且一般来说直接使用网卡NAT转发性能会更高,
|
||||
有需要可以自行配置NAT转发,[可参考‘编译’小节中的NAT配置](https://github.com/lbl8603/vnt#%E7%BC%96%E8%AF%91)
|
||||
@@ -116,6 +118,7 @@ punch_model: ipv4 #打洞模式
|
||||
port: 0 #使用随机端口
|
||||
cmd: false #关闭控制台输入
|
||||
no_proxy: false #是否关闭内置代理,true为关闭
|
||||
first_latency: false #是否优先低延迟通道,默认为false,表示优先使用p2p通道
|
||||
```
|
||||
|
||||
或者需要哪个配置就加哪个,当然token是必须的
|
||||
|
||||
@@ -33,6 +33,7 @@ pub struct FileConfig {
|
||||
pub punch_model: String,
|
||||
pub port: u16,
|
||||
pub cmd: bool,
|
||||
pub first_latency: bool,
|
||||
}
|
||||
|
||||
impl Default for FileConfig {
|
||||
@@ -64,6 +65,7 @@ impl Default for FileConfig {
|
||||
punch_model: "".to_string(),
|
||||
port: 0,
|
||||
cmd: false,
|
||||
first_latency: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -155,6 +157,7 @@ pub fn read_config(file_path: &str) -> io::Result<(Config, bool)> {
|
||||
file_conf.finger,
|
||||
punch_model,
|
||||
file_conf.port,
|
||||
file_conf.first_latency,
|
||||
);
|
||||
Ok((config, file_conf.cmd))
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ fn main() {
|
||||
opts.optopt("", "port", "监听的端口", "<port>");
|
||||
opts.optflag("", "cmd", "开启窗口输入");
|
||||
opts.optflag("", "no-proxy", "关闭内置代理");
|
||||
opts.optflag("", "first-latency", "优先延迟");
|
||||
opts.optopt("f", "", "配置文件", "<conf>");
|
||||
//"后台运行时,查看其他设备列表"
|
||||
opts.optflag("", "list", "后台运行时,查看其他设备列表");
|
||||
@@ -261,6 +262,7 @@ fn main() {
|
||||
let cmd = matches.opt_present("cmd");
|
||||
#[cfg(feature = "ip_proxy")]
|
||||
let no_proxy = matches.opt_present("no-proxy");
|
||||
let first_latency = matches.opt_present("first-latency");
|
||||
let config = Config::new(
|
||||
tap,
|
||||
token,
|
||||
@@ -285,6 +287,7 @@ fn main() {
|
||||
finger,
|
||||
punch_model,
|
||||
port,
|
||||
first_latency,
|
||||
);
|
||||
(config, cmd)
|
||||
};
|
||||
@@ -541,6 +544,7 @@ fn print_usage(program: &str, _opts: Options) {
|
||||
println!(" --cmd 开启交互式命令,使用此参数开启控制台输入");
|
||||
#[cfg(feature = "ip_proxy")]
|
||||
println!(" --no-proxy 关闭内置代理,如需点对网则需要配置网卡NAT转发");
|
||||
println!(" --first-latency 优先低延迟的通道,默认情况优先使用p2p通道");
|
||||
|
||||
println!();
|
||||
println!(
|
||||
|
||||
Reference in New Issue
Block a user