Skip to content
Snippets Groups Projects
Unverified Commit 9e3c0809 authored by GyDi's avatar GyDi Committed by GitHub
Browse files

fix: adjust dns config

parent cb661aae
No related branches found
No related tags found
No related merge requests found
......@@ -179,18 +179,17 @@ impl Clash {
revise!(config, "tun", new_tun);
// dns config
let dns_val = config.get(&Value::from("dns"));
let mut new_dns = Mapping::new();
if dns_val.is_some() && dns_val.as_ref().unwrap().is_mapping() {
new_dns = dns_val.as_ref().unwrap().as_mapping().unwrap().clone();
}
if enable {
// dns config
let dns_val = config.get(&Value::from("dns"));
let mut new_dns = Mapping::new();
// 借鉴cfw的默认配置
revise!(new_dns, "enable", enable);
if dns_val.is_some() && dns_val.as_ref().unwrap().is_mapping() {
new_dns = dns_val.as_ref().unwrap().as_mapping().unwrap().clone();
}
revise!(new_dns, "enable", enable);
if enable {
// 借鉴cfw的默认配置
append!(new_dns, "enhanced-mode", "fake-ip");
append!(
new_dns,
......@@ -209,9 +208,10 @@ impl Clash {
"www.msftconnecttest.com"
]
);
revise!(config, "dns", new_dns);
}
revise!(config, "dns", new_dns);
config
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment