fix: adjust dns config
This commit is contained in:
parent
cb661aaebd
commit
9e3c080909
@ -179,6 +179,7 @@ impl Clash {
|
|||||||
|
|
||||||
revise!(config, "tun", new_tun);
|
revise!(config, "tun", new_tun);
|
||||||
|
|
||||||
|
if enable {
|
||||||
// dns config
|
// dns config
|
||||||
let dns_val = config.get(&Value::from("dns"));
|
let dns_val = config.get(&Value::from("dns"));
|
||||||
let mut new_dns = Mapping::new();
|
let mut new_dns = Mapping::new();
|
||||||
@ -186,11 +187,9 @@ impl Clash {
|
|||||||
if dns_val.is_some() && dns_val.as_ref().unwrap().is_mapping() {
|
if dns_val.is_some() && dns_val.as_ref().unwrap().is_mapping() {
|
||||||
new_dns = dns_val.as_ref().unwrap().as_mapping().unwrap().clone();
|
new_dns = dns_val.as_ref().unwrap().as_mapping().unwrap().clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 借鉴cfw的默认配置
|
|
||||||
revise!(new_dns, "enable", enable);
|
revise!(new_dns, "enable", enable);
|
||||||
|
|
||||||
if enable {
|
// 借鉴cfw的默认配置
|
||||||
append!(new_dns, "enhanced-mode", "fake-ip");
|
append!(new_dns, "enhanced-mode", "fake-ip");
|
||||||
append!(
|
append!(
|
||||||
new_dns,
|
new_dns,
|
||||||
@ -209,9 +208,10 @@ impl Clash {
|
|||||||
"www.msftconnecttest.com"
|
"www.msftconnecttest.com"
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
revise!(config, "dns", new_dns);
|
revise!(config, "dns", new_dns);
|
||||||
|
}
|
||||||
|
|
||||||
config
|
config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user