diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2023-10-23 15:59:57 +0200 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2023-10-24 11:35:10 +0200 |
| commit | b03acde70aa3b64e9c934c5fc51f1b00d1ec6a5d (patch) | |
| tree | 223a20d093a1d79d7c7f46710737028804e2a49e /test | |
| parent | cec5f59720e6c29468ddaeb9b61b4f166fbdd6f2 (diff) | |
| download | mullvadvpn-b03acde70aa3b64e9c934c5fc51f1b00d1ec6a5d.tar.xz mullvadvpn-b03acde70aa3b64e9c934c5fc51f1b00d1ec6a5d.zip | |
Document & simplify `reset_relay_settings`
Diffstat (limited to 'test')
| -rw-r--r-- | test/test-manager/src/tests/helpers.rs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/test/test-manager/src/tests/helpers.rs b/test/test-manager/src/tests/helpers.rs index e5f8c6034e..2b68dbda0a 100644 --- a/test/test-manager/src/tests/helpers.rs +++ b/test/test-manager/src/tests/helpers.rs @@ -319,20 +319,24 @@ impl<T> Drop for AbortOnDrop<T> { } /// Disconnect and reset all relay, bridge, and obfuscation settings. +/// +/// See [`mullvad_types::relay_constraints::RelayConstraintsUpdate`] for details, but in short: +/// * Location constraint is [`Constraint::Any`] +/// * Provider constraint is [`Constraint::Any`] +/// * Ownership constraint is [`Constraint::Any`] +/// * The default tunnel protocol is [`talpid_types::net::TunnelType::Wireguard`] +/// * Wireguard settings are default (i.e. any port is used, no obfuscation ..) +/// see [`mullvad_types::relay_constraints::WireguardConstraints`] for details. +/// * OpenVPN settings are default (i.e. any port is used, no obfuscation ..) +/// see [`mullvad_types::relay_constraints::OpenVpnConstraints`] for details. pub async fn reset_relay_settings( mullvad_client: &mut ManagementServiceClient, ) -> Result<(), Error> { disconnect_and_wait(mullvad_client).await?; - let relay_settings = RelaySettingsUpdate::Normal(RelayConstraintsUpdate { - location: Some(Constraint::Only(LocationConstraint::Location( - GeographicLocationConstraint::Country("se".to_string()), - ))), - tunnel_protocol: Some(Constraint::Any), - openvpn_constraints: Some(OpenVpnConstraints::default()), - wireguard_constraints: Some(WireguardConstraints::default()), - ..Default::default() - }); + let relay_settings = RelaySettingsUpdate::Normal(RelayConstraintsUpdate::default()); + let bridge_state = BridgeState::Auto; + let obfuscation_settings = ObfuscationSettings::default(); update_relay_settings(mullvad_client, relay_settings) .await @@ -341,20 +345,16 @@ pub async fn reset_relay_settings( })?; mullvad_client - .set_bridge_state(types::BridgeState { - state: i32::from(types::bridge_state::State::Auto), - }) + .set_bridge_state(types::BridgeState::from(bridge_state)) .await .map_err(|error| Error::DaemonError(format!("Failed to reset bridge mode: {}", error)))?; mullvad_client - .set_obfuscation_settings(types::ObfuscationSettings { - selected_obfuscation: i32::from(types::obfuscation_settings::SelectedObfuscation::Off), - udp2tcp: Some(types::Udp2TcpObfuscationSettings { port: None }), - }) + .set_obfuscation_settings(types::ObfuscationSettings::from(obfuscation_settings)) .await - .map(|_| ()) - .map_err(|error| Error::DaemonError(format!("Failed to reset obfuscation: {}", error))) + .map_err(|error| Error::DaemonError(format!("Failed to reset obfuscation: {}", error)))?; + + Ok(()) } pub async fn update_relay_settings( |
