refactor: update_core_config, simplify logic and delete invalid notifications

This commit is contained in:
huzibaca
2024-11-30 05:43:59 +08:00
parent 3bc4da3e85
commit 16c9c95e19
7 changed files with 16 additions and 37 deletions

View File

@@ -30,7 +30,10 @@ pub async fn use_tun(mut config: Mapping, enable: bool, origin_dns_val: Mapping)
val.as_mapping().cloned().unwrap_or(Mapping::new())
});
let ipv6_key = Value::from("ipv6");
let ipv6_val = config.get(&ipv6_key).and_then(|v| v.as_bool()).unwrap_or(false);
let ipv6_val = config
.get(&ipv6_key)
.and_then(|v| v.as_bool())
.unwrap_or(false);
if enable {
revise!(dns_val, "enable", true);