mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-04 05:00:05 +08:00
fix(config): fill blank IPv6 fake IP ranges in TUN mode
This commit is contained in:
@@ -882,6 +882,15 @@ mod use_tun_tests {
|
||||
Some(&Value::from("2001:2::0/64"))
|
||||
);
|
||||
|
||||
let blank_range = mapping(&[
|
||||
("ipv6", Value::from(true)),
|
||||
("dns", Value::Mapping(mapping(&[("fake-ip-range6", Value::from(" "))]))),
|
||||
]);
|
||||
assert_eq!(
|
||||
use_tun(blank_range, true)["dns"]["fake-ip-range6"],
|
||||
Value::from("2001:2::0/64")
|
||||
);
|
||||
|
||||
let without_ipv6 = use_tun(Mapping::new(), true);
|
||||
let dns = dns_of(&without_ipv6).expect("dns should be written");
|
||||
assert!(!dns.contains_key(Value::from("fake-ip-range6")));
|
||||
|
||||
@@ -32,9 +32,7 @@ pub fn use_tun(mut config: Mapping, enable: bool) -> Mapping {
|
||||
revise!(dns_val, "fake-ip-range", "198.18.0.1/16");
|
||||
}
|
||||
|
||||
if ipv6_val && !dns_val.contains_key(Value::from("fake-ip-range6")) {
|
||||
revise!(dns_val, "fake-ip-range6", "2001:2::0/64");
|
||||
}
|
||||
super::ensure_fake_ip_range6(&mut dns_val);
|
||||
}
|
||||
|
||||
revise!(config, "dns", dns_val);
|
||||
|
||||
Reference in New Issue
Block a user