mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 05:03:45 +08:00
fix: fixer #2158
This commit is contained in:
parent
e25d71c6c8
commit
94d22ecfc3
@ -60,6 +60,7 @@ pub async fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
|
||||
global_merge,
|
||||
global_script,
|
||||
profile_name,
|
||||
dns_enhanced_mode,
|
||||
) = {
|
||||
let profiles = Config::profiles();
|
||||
let profiles = profiles.latest();
|
||||
@ -130,6 +131,13 @@ pub async fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
|
||||
.and_then(|item| item.name.clone())
|
||||
.unwrap_or_default();
|
||||
|
||||
let dns_enhanced_mode = current
|
||||
.get("dns")
|
||||
.and_then(|val| val.get("enhanced-mode"))
|
||||
.and_then(|val| val.as_str())
|
||||
.unwrap_or("redir-host")
|
||||
.to_string();
|
||||
|
||||
(
|
||||
current,
|
||||
merge,
|
||||
@ -140,6 +148,7 @@ pub async fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
|
||||
global_merge,
|
||||
global_script,
|
||||
name,
|
||||
dns_enhanced_mode,
|
||||
)
|
||||
};
|
||||
|
||||
@ -259,7 +268,7 @@ pub async fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
|
||||
});
|
||||
}
|
||||
|
||||
config = use_tun(config, enable_tun).await;
|
||||
config = use_tun(config, enable_tun, dns_enhanced_mode).await;
|
||||
config = use_sort(config);
|
||||
|
||||
let mut exists_set = HashSet::new();
|
||||
|
@ -18,7 +18,7 @@ macro_rules! append {
|
||||
};
|
||||
}
|
||||
|
||||
pub async fn use_tun(mut config: Mapping, enable: bool) -> Mapping {
|
||||
pub async fn use_tun(mut config: Mapping, enable: bool, origin_enhanced_mode: String) -> Mapping {
|
||||
let tun_key = Value::from("tun");
|
||||
let tun_val = config.get(&tun_key);
|
||||
let mut tun_val = tun_val.map_or(Mapping::new(), |val| {
|
||||
@ -41,7 +41,7 @@ pub async fn use_tun(mut config: Mapping, enable: bool) -> Mapping {
|
||||
crate::utils::resolve::set_public_dns("8.8.8.8".to_string()).await;
|
||||
}
|
||||
} else {
|
||||
revise!(dns_val, "enhanced-mode", "redir-host");
|
||||
revise!(dns_val, "enhanced-mode", origin_enhanced_mode.as_str());
|
||||
#[cfg(target_os = "macos")]
|
||||
crate::utils::resolve::restore_public_dns().await;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user