diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-09-05 18:39:51 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-09-05 18:39:51 +0200 |
| commit | 619e081cb90c3cf6b49c51e81ea6f6c3fbe1d9a9 (patch) | |
| tree | 5a5601eddbc639aa80808f80bf184ab97fe00220 /mullvad-daemon/src | |
| parent | fb40dedf46348e8764aed95610b135e40c3b1ba1 (diff) | |
| parent | c3eeeaaa9db90bbf4c6328286854e850d2f8156b (diff) | |
| download | mullvadvpn-619e081cb90c3cf6b49c51e81ea6f6c3fbe1d9a9.tar.xz mullvadvpn-619e081cb90c3cf6b49c51e81ea6f6c3fbe1d9a9.zip | |
Merge branch 'select-individual-servers'
Diffstat (limited to 'mullvad-daemon/src')
| -rw-r--r-- | mullvad-daemon/src/relays.rs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/mullvad-daemon/src/relays.rs b/mullvad-daemon/src/relays.rs index 86d4efbc51..fea9bd8340 100644 --- a/mullvad-daemon/src/relays.rs +++ b/mullvad-daemon/src/relays.rs @@ -70,8 +70,9 @@ impl ParsedRelays { let city_code = city.code.clone(); let latitude = city.latitude; let longitude = city.longitude; - relays.extend(city.relays.drain(..).map(|mut relay| { - relay.location = Some(Location { + for relay in &mut city.relays { + let mut relay_with_location = relay.clone(); + relay_with_location.location = Some(Location { country: country_name.clone(), country_code: country_code.clone(), city: city_name.clone(), @@ -79,8 +80,9 @@ impl ParsedRelays { latitude, longitude, }); - relay - })); + relays.push(relay_with_location); + relay.tunnels.clear(); + } } } ParsedRelays { @@ -259,6 +261,14 @@ impl RelaySelector { loc.country_code == *country && loc.city_code == *city }) } + Constraint::Only(LocationConstraint::Hostname(ref country, ref city, ref hostname)) => { + relay + .location + .as_ref() + .map_or(relay.hostname == *hostname, |loc| { + loc.country_code == *country && loc.city_code == *city + }) + } }; if !matches_location { return None; |
