add options to gui to enable kcp (#583)

* add test to kcp
* add options to gui to enable kcp
This commit is contained in:
Sijie.Sun
2025-01-26 13:31:20 +08:00
committed by GitHub
parent 55a39491cb
commit b69b122c8d
7 changed files with 104 additions and 5 deletions

View File

@@ -31,7 +31,7 @@ pub fn gen_default_flags() -> Flags {
data_compress_algo: CompressionAlgoPb::None.into(),
bind_device: true,
enable_kcp_proxy: false,
disable_kcp_input: true,
disable_kcp_input: false,
disable_relay_kcp: true,
}
}

View File

@@ -525,6 +525,31 @@ impl NetworkConfig {
if let Some(dev_name) = self.dev_name.clone() {
flags.dev_name = dev_name;
}
if let Some(use_smoltcp) = self.use_smoltcp {
flags.use_smoltcp = use_smoltcp;
}
if let Some(enable_kcp_proxy) = self.enable_kcp_proxy {
flags.enable_kcp_proxy = enable_kcp_proxy;
}
if let Some(disable_kcp_input) = self.disable_kcp_input {
flags.disable_kcp_input = disable_kcp_input;
}
if let Some(disable_p2p) = self.disable_p2p {
flags.disable_p2p = disable_p2p;
}
if let Some(bind_device) = self.bind_device {
flags.bind_device = bind_device;
}
if let Some(no_tun) = self.no_tun {
flags.no_tun = no_tun;
}
cfg.set_flags(flags);
Ok(cfg)
}

View File

@@ -40,6 +40,13 @@ message NetworkConfig {
optional bool latency_first = 19;
optional string dev_name = 20;
optional bool use_smoltcp = 21;
optional bool enable_kcp_proxy = 22;
optional bool disable_kcp_input = 23;
optional bool disable_p2p = 24;
optional bool bind_device = 25;
optional bool no_tun = 26;
}
message MyNodeInfo {

View File

@@ -364,6 +364,7 @@ pub async fn subnet_proxy_three_node_test(
#[values("tcp", "udp", "wg")] proto: &str,
#[values(true, false)] no_tun: bool,
#[values(true, false)] relay_by_public_server: bool,
#[values(true, false)] enable_kcp_proxy: bool,
) {
let insts = init_three_node_ex(
proto,
@@ -382,6 +383,12 @@ pub async fn subnet_proxy_three_node_test(
));
}
if cfg.get_inst_name() == "inst1" && enable_kcp_proxy {
let mut flags = cfg.get_flags();
flags.enable_kcp_proxy = true;
cfg.set_flags(flags);
}
cfg
},
relay_by_public_server,