summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--Cargo.lock7
-rw-r--r--gui/src/renderer/app.tsx6
-rw-r--r--mullvad-cli/Cargo.toml7
-rw-r--r--mullvad-cli/src/cmds/bridge.rs6
-rw-r--r--mullvad-cli/src/cmds/relay.rs6
6 files changed, 21 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 29c4985508..d608aefd94 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,6 +34,7 @@ Line wrap the file at 100 chars. Th
- WireGuard key generation will try to replace old key if one exists.
- Show banner about new app versions only if current platform has changes in latest release.
- Don't make a GeoIP lookup by default in CLI status command. Add --location flag for enabling it.
+- Sort relay locations and hostnames with natural sorting. Meaning `se10` will show up after `se2`.
### Fixed
- Fix old settings deserialization to allow migrating settings from versions older than 2019.6.
diff --git a/Cargo.lock b/Cargo.lock
index 78ab2aac80..b436f2a6e0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1191,6 +1191,7 @@ dependencies = [
"mullvad-ipc-client 0.1.0",
"mullvad-paths 0.1.0",
"mullvad-types 0.1.0",
+ "natord 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
"talpid-ipc 0.1.0",
"talpid-types 0.1.0",
@@ -1375,6 +1376,11 @@ dependencies = [
]
[[package]]
+name = "natord"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "net2"
version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3113,6 +3119,7 @@ dependencies = [
"checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226"
"checksum mnl 0.1.0 (git+https://github.com/mullvad/mnl-rs?rev=f0d19501b9b85be9a1ffaec8317a378bcbdf4fa6)" = "<none>"
"checksum mnl-sys 0.1.0 (git+https://github.com/mullvad/mnl-rs?rev=f0d19501b9b85be9a1ffaec8317a378bcbdf4fa6)" = "<none>"
+"checksum natord 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "308d96db8debc727c3fd9744aac51751243420e46edf401010908da7f8d5e57c"
"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
"checksum netlink-packet 0.1.1 (git+https://github.com/mullvad/netlink?rev=f768adfcc8c6b064ef7ae3c792c4c21d0d96d0b5)" = "<none>"
"checksum netlink-proto 0.1.1 (git+https://github.com/mullvad/netlink?rev=f768adfcc8c6b064ef7ae3c792c4c21d0d96d0b5)" = "<none>"
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index 69c55d4000..4a6910d4e8 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -563,12 +563,12 @@ export default class AppRenderer {
longitude: city.longitude,
hasActiveRelays: city.relays.some((relay) => relay.active),
relays: city.relays.sort((relayA, relayB) =>
- relayA.hostname.localeCompare(relayB.hostname),
+ relayA.hostname.localeCompare(relayB.hostname, this.locale, { numeric: true }),
),
}))
- .sort((cityA, cityB) => cityA.name.localeCompare(cityB.name)),
+ .sort((cityA, cityB) => cityA.name.localeCompare(cityB.name, this.locale)),
}))
- .sort((countryA, countryB) => countryA.name.localeCompare(countryB.name));
+ .sort((countryA, countryB) => countryA.name.localeCompare(countryB.name, this.locale));
}
private setRelays(relayList: IRelayList) {
diff --git a/mullvad-cli/Cargo.toml b/mullvad-cli/Cargo.toml
index 6b13453a2e..07170cb157 100644
--- a/mullvad-cli/Cargo.toml
+++ b/mullvad-cli/Cargo.toml
@@ -18,13 +18,14 @@ name = "mullvad"
path = "src/main.rs"
[dependencies]
+base64 = "0.10"
+chrono = { version = "0.4", features = ["serde"] }
clap = "2.32"
err-derive = "0.1.5"
env_logger = "0.6"
-serde = "1.0"
futures = "0.1"
-base64 = "0.10"
-chrono = { version = "0.4", features = ["serde"] }
+natord = "1.0.9"
+serde = "1.0"
mullvad-ipc-client = { path = "../mullvad-ipc-client" }
mullvad-types = { path = "../mullvad-types" }
diff --git a/mullvad-cli/src/cmds/bridge.rs b/mullvad-cli/src/cmds/bridge.rs
index a2b8a0abc1..d0538e0d7c 100644
--- a/mullvad-cli/src/cmds/bridge.rs
+++ b/mullvad-cli/src/cmds/bridge.rs
@@ -342,15 +342,15 @@ impl Bridge {
locations
.countries
- .sort_by(|c1, c2| c1.name.to_lowercase().cmp(&c2.name.to_lowercase()));
+ .sort_by(|c1, c2| natord::compare_ignore_case(&c1.name, &c2.name));
for mut country in locations.countries {
country
.cities
- .sort_by(|c1, c2| c1.name.to_lowercase().cmp(&c2.name.to_lowercase()));
+ .sort_by(|c1, c2| natord::compare_ignore_case(&c1.name, &c2.name));
println!("{} ({})", country.name, country.code);
for mut city in country.cities {
city.relays
- .sort_by(|r1, r2| r1.hostname.to_lowercase().cmp(&r2.hostname.to_lowercase()));
+ .sort_by(|r1, r2| natord::compare_ignore_case(&r1.hostname, &r2.hostname));
println!(
"\t{} ({}) @ {:.5}°N, {:.5}°W",
city.name, city.code, city.latitude, city.longitude
diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs
index a86270bcf0..eaafcc0cb9 100644
--- a/mullvad-cli/src/cmds/relay.rs
+++ b/mullvad-cli/src/cmds/relay.rs
@@ -344,15 +344,15 @@ impl Relay {
locations
.countries
- .sort_by(|c1, c2| c1.name.to_lowercase().cmp(&c2.name.to_lowercase()));
+ .sort_by(|c1, c2| natord::compare_ignore_case(&c1.name, &c2.name));
for mut country in locations.countries {
country
.cities
- .sort_by(|c1, c2| c1.name.to_lowercase().cmp(&c2.name.to_lowercase()));
+ .sort_by(|c1, c2| natord::compare_ignore_case(&c1.name, &c2.name));
println!("{} ({})", country.name, country.code);
for mut city in country.cities {
city.relays
- .sort_by(|r1, r2| r1.hostname.to_lowercase().cmp(&r2.hostname.to_lowercase()));
+ .sort_by(|r1, r2| natord::compare_ignore_case(&r1.hostname, &r2.hostname));
println!(
"\t{} ({}) @ {:.5}°N, {:.5}°W",
city.name, city.code, city.latitude, city.longitude