summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src/cmds
diff options
context:
space:
mode:
authorJonathan <jonathan@mullvad.net>2023-06-28 14:36:24 +0200
committerJonathan <jonathan@mullvad.net>2023-06-29 15:00:10 +0200
commit5f61ba4058337e6985cee99661a59a98ebff6dd0 (patch)
treeba94b7e0829f2fd57a9974b4590af59e9937e5be /mullvad-cli/src/cmds
parentb4bf8124fbc30bf891f70f120265f30c490d1244 (diff)
downloadmullvadvpn-5f61ba4058337e6985cee99661a59a98ebff6dd0.tar.xz
mullvadvpn-5f61ba4058337e6985cee99661a59a98ebff6dd0.zip
Add settings migration code, refactor and cleanup
Bump the settings version. Add code for migrating settings to new version since it is now not backwards compatible. Refactor LocationConstraint and related types to be more lean. Cleanup issues and fix formatting. Refactor LocationConstraint and add migration code
Diffstat (limited to 'mullvad-cli/src/cmds')
-rw-r--r--mullvad-cli/src/cmds/bridge.rs2
-rw-r--r--mullvad-cli/src/cmds/relay.rs6
-rw-r--r--mullvad-cli/src/cmds/relay_constraints.rs2
3 files changed, 5 insertions, 5 deletions
diff --git a/mullvad-cli/src/cmds/bridge.rs b/mullvad-cli/src/cmds/bridge.rs
index e43fce1b51..3cc1a95b37 100644
--- a/mullvad-cli/src/cmds/bridge.rs
+++ b/mullvad-cli/src/cmds/bridge.rs
@@ -168,7 +168,7 @@ impl Bridge {
} else {
Constraint::from(location)
};
- let location = location.map(|location| LocationConstraint::Location { location });
+ let location = location.map(LocationConstraint::Location);
Self::update_bridge_settings(&mut rpc, Some(location), None, None).await
}
SetCommands::CustomList { custom_list_name } => {
diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs
index 1bb395c4e5..83f4ad4fdd 100644
--- a/mullvad-cli/src/cmds/relay.rs
+++ b/mullvad-cli/src/cmds/relay.rs
@@ -450,7 +450,7 @@ impl Relay {
// The country field is assumed to be hostname due to CLI argument parsing
find_relay_by_hostname(&countries, &location_constraint_args.country)
{
- Constraint::Only(LocationConstraint::Location { location: relay })
+ Constraint::Only(LocationConstraint::Location(relay))
} else {
let location_constraint: Constraint<GeographicLocationConstraint> =
Constraint::from(location_constraint_args);
@@ -468,7 +468,7 @@ impl Relay {
}
}
}
- location_constraint.map(|location| LocationConstraint::Location { location })
+ location_constraint.map(LocationConstraint::Location)
};
Self::update_constraints(RelaySettingsUpdate::Normal(RelayConstraintsUpdate {
@@ -576,7 +576,7 @@ impl Relay {
// The country field is assumed to be hostname due to CLI argument parsing
wireguard_constraints.entry_location =
if let Some(relay) = find_relay_by_hostname(&countries, &entry.country) {
- Constraint::Only(LocationConstraint::Location { location: relay })
+ Constraint::Only(LocationConstraint::Location(relay))
} else {
Constraint::from(entry)
};
diff --git a/mullvad-cli/src/cmds/relay_constraints.rs b/mullvad-cli/src/cmds/relay_constraints.rs
index dc79e79f0b..626754edcb 100644
--- a/mullvad-cli/src/cmds/relay_constraints.rs
+++ b/mullvad-cli/src/cmds/relay_constraints.rs
@@ -49,6 +49,6 @@ impl From<LocationArgs> for Constraint<LocationConstraint> {
}
_ => unreachable!("invalid location arguments"),
};
- Constraint::Only(LocationConstraint::Location { location })
+ Constraint::Only(LocationConstraint::Location(location))
}
}