fix: extension script dns is overwritten fixer #2235

This commit is contained in:
huzibaca
2024-12-06 12:35:09 +08:00
parent d233a84362
commit d22b37c7bf
2 changed files with 5 additions and 11 deletions

View File

@@ -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_val = config.get(&tun_key);
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!(
dns_val,
"enable",
origin_dns_val
dns_val
.get("enable")
.and_then(|v| v.as_bool())
.unwrap_or(true)
@@ -60,7 +60,7 @@ pub async fn use_tun(mut config: Mapping, enable: bool, origin_dns_val: Mapping)
revise!(
dns_val,
"enhanced-mode",
origin_dns_val
dns_val
.get("enhanced-mode")
.and_then(|v| v.as_str())
.unwrap_or("redir-host")
@@ -69,7 +69,7 @@ pub async fn use_tun(mut config: Mapping, enable: bool, origin_dns_val: Mapping)
revise!(
dns_val,
"fake-ip-range",
origin_dns_val
dns_val
.get("fake-ip-range")
.and_then(|v| v.as_str())
.unwrap_or("198.18.0.1/16")