refactor: tun mode is turned on and off, does not depend on services, and does not affect other configurations

This commit is contained in:
huzibaca
2024-10-05 22:45:59 +08:00
parent 1178f7c892
commit 0541a0c69f
6 changed files with 28 additions and 158 deletions

View File

@@ -25,7 +25,7 @@ pub async fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
// config.yaml 的订阅
let clash_config = { Config::clash().latest().0.clone() };
let (clash_core, enable_tun, enable_builtin, socks_enabled, http_enabled, enable_service_mode) = {
let (clash_core, enable_tun, enable_builtin, socks_enabled, http_enabled) = {
let verge = Config::verge();
let verge = verge.latest();
(
@@ -34,7 +34,6 @@ pub async fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
verge.enable_builtin_enhanced.unwrap_or(true),
verge.verge_socks_enabled.unwrap_or(false),
verge.verge_http_enabled.unwrap_or(false),
verge.enable_service_mode.unwrap_or(false),
)
};
#[cfg(not(target_os = "windows"))]
@@ -260,7 +259,9 @@ pub async fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
});
}
config = use_tun(config, enable_tun, enable_service_mode).await;
if enable_tun {
config = use_tun(config).await;
}
config = use_sort(config);
let mut exists_set = HashSet::new();