Skip to content

Commit

Permalink
fix: adjust dns config
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzgydi authored Apr 21, 2022
1 parent cb661aa commit 9e3c080
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src-tauri/src/core/clash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -209,9 +208,10 @@ impl Clash {
"www.msftconnecttest.com"
]
);

revise!(config, "dns", new_dns);
}

revise!(config, "dns", new_dns);
config
}

Expand Down

0 comments on commit 9e3c080

Please sign in to comment.