Skip to content

Commit 38aeb2b

Browse files
committed
Try obfuscated proxies until only plain remain
1 parent 6b23ab1 commit 38aeb2b

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

Diff for: mullvad-ios/src/encrypted_dns_proxy.rs

+9-12
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub struct EncryptedDnsProxyState {
1313
/// Note that we rely on the randomness of the ordering of the items in the hashset to pick a
1414
/// random configurations every time.
1515
configurations: HashSet<ProxyConfig>,
16-
has_tried_xor: bool,
1716
tried_configurations: HashSet<ProxyConfig>,
1817
}
1918

@@ -94,17 +93,15 @@ impl EncryptedDnsProxyState {
9493
}
9594

9695
fn next_configuration(&mut self) -> Option<ProxyConfig> {
97-
if !self.has_tried_xor {
98-
self.has_tried_xor = true;
99-
if let Some(xor_config) = self
100-
.configurations
101-
.iter()
102-
// prefer obfuscated proxy configurations.
103-
.find(|config| config.obfuscation.is_some())
104-
{
105-
self.tried_configurations.insert(xor_config.clone());
106-
return Some(xor_config.clone());
107-
}
96+
if let Some(xor_config) = self
97+
.configurations
98+
.diference(&self.tried_configurations)
99+
// prefer obfuscated proxy configurations.
100+
.find(|config| config.obfuscation.is_some())
101+
.cloned()
102+
{
103+
self.tried_configurations.insert(xor_config.clone());
104+
return Some(xor_config);
108105
}
109106

110107
let config = self

0 commit comments

Comments
 (0)