mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-04 20:07:32 +08:00
fix: extension script dns is overwritten fixer #2235
This commit is contained in:
parent
d233a84362
commit
d22b37c7bf
@ -60,7 +60,6 @@ pub async fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
|
|||||||
global_merge,
|
global_merge,
|
||||||
global_script,
|
global_script,
|
||||||
profile_name,
|
profile_name,
|
||||||
dns,
|
|
||||||
) = {
|
) = {
|
||||||
let profiles = Config::profiles();
|
let profiles = Config::profiles();
|
||||||
let profiles = profiles.latest();
|
let profiles = profiles.latest();
|
||||||
@ -131,10 +130,6 @@ pub async fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
|
|||||||
.and_then(|item| item.name.clone())
|
.and_then(|item| item.name.clone())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let dns = current.get("dns").map_or(Mapping::new(), |val| {
|
|
||||||
val.as_mapping().cloned().unwrap_or(Mapping::new())
|
|
||||||
});
|
|
||||||
|
|
||||||
(
|
(
|
||||||
current,
|
current,
|
||||||
merge,
|
merge,
|
||||||
@ -145,7 +140,6 @@ pub async fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
|
|||||||
global_merge,
|
global_merge,
|
||||||
global_script,
|
global_script,
|
||||||
name,
|
name,
|
||||||
dns,
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -265,7 +259,7 @@ pub async fn enhance() -> (Mapping, Vec<String>, HashMap<String, ResultLog>) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
config = use_tun(config, enable_tun, dns).await;
|
config = use_tun(config, enable_tun).await;
|
||||||
config = use_sort(config);
|
config = use_sort(config);
|
||||||
|
|
||||||
let mut exists_set = HashSet::new();
|
let mut exists_set = HashSet::new();
|
||||||
|
@ -18,7 +18,7 @@ macro_rules! append {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn use_tun(mut config: Mapping, enable: bool, origin_dns_val: Mapping) -> Mapping {
|
pub async fn use_tun(mut config: Mapping, enable: bool) -> Mapping {
|
||||||
let tun_key = Value::from("tun");
|
let tun_key = Value::from("tun");
|
||||||
let tun_val = config.get(&tun_key);
|
let tun_val = config.get(&tun_key);
|
||||||
let mut tun_val = tun_val.map_or(Mapping::new(), |val| {
|
let mut tun_val = tun_val.map_or(Mapping::new(), |val| {
|
||||||
@ -49,7 +49,7 @@ pub async fn use_tun(mut config: Mapping, enable: bool, origin_dns_val: Mapping)
|
|||||||
revise!(
|
revise!(
|
||||||
dns_val,
|
dns_val,
|
||||||
"enable",
|
"enable",
|
||||||
origin_dns_val
|
dns_val
|
||||||
.get("enable")
|
.get("enable")
|
||||||
.and_then(|v| v.as_bool())
|
.and_then(|v| v.as_bool())
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
@ -60,7 +60,7 @@ pub async fn use_tun(mut config: Mapping, enable: bool, origin_dns_val: Mapping)
|
|||||||
revise!(
|
revise!(
|
||||||
dns_val,
|
dns_val,
|
||||||
"enhanced-mode",
|
"enhanced-mode",
|
||||||
origin_dns_val
|
dns_val
|
||||||
.get("enhanced-mode")
|
.get("enhanced-mode")
|
||||||
.and_then(|v| v.as_str())
|
.and_then(|v| v.as_str())
|
||||||
.unwrap_or("redir-host")
|
.unwrap_or("redir-host")
|
||||||
@ -69,7 +69,7 @@ pub async fn use_tun(mut config: Mapping, enable: bool, origin_dns_val: Mapping)
|
|||||||
revise!(
|
revise!(
|
||||||
dns_val,
|
dns_val,
|
||||||
"fake-ip-range",
|
"fake-ip-range",
|
||||||
origin_dns_val
|
dns_val
|
||||||
.get("fake-ip-range")
|
.get("fake-ip-range")
|
||||||
.and_then(|v| v.as_str())
|
.and_then(|v| v.as_str())
|
||||||
.unwrap_or("198.18.0.1/16")
|
.unwrap_or("198.18.0.1/16")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user