mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-12 12:47:25 +08:00
import/export network config for web (#676)
* import/export network config for web * add socks5 config for web
This commit is contained in:
@@ -540,6 +540,16 @@ impl NetworkConfig {
|
||||
cfg.set_exit_nodes(exit_nodes);
|
||||
}
|
||||
|
||||
if self.enable_socks5.unwrap_or_default() {
|
||||
if let Some(socks5_port) = self.socks5_port {
|
||||
cfg.set_socks5_portal(Some(
|
||||
format!("socks5://0.0.0.0:{}", socks5_port)
|
||||
.parse()
|
||||
.unwrap(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
let mut flags = gen_default_flags();
|
||||
if let Some(latency_first) = self.latency_first {
|
||||
flags.latency_first = latency_first;
|
||||
@@ -589,6 +599,10 @@ impl NetworkConfig {
|
||||
flags.proxy_forward_by_system = proxy_forward_by_system;
|
||||
}
|
||||
|
||||
if let Some(disable_encryption) = self.disable_encryption {
|
||||
flags.enable_encryption = !disable_encryption;
|
||||
}
|
||||
|
||||
if self.enable_relay_network_whitelist.unwrap_or_default() {
|
||||
if self.relay_network_whitelist.len() > 0 {
|
||||
flags.relay_network_whitelist = self.relay_network_whitelist.join(" ")
|
||||
|
||||
@@ -57,6 +57,9 @@ message NetworkConfig {
|
||||
repeated string routes = 33;
|
||||
repeated string exit_nodes = 34;
|
||||
optional bool proxy_forward_by_system = 35;
|
||||
optional bool disable_encryption = 36;
|
||||
optional bool enable_socks5 = 37;
|
||||
optional int32 socks5_port = 38;
|
||||
}
|
||||
|
||||
message MyNodeInfo {
|
||||
|
||||
Reference in New Issue
Block a user