summaryrefslogtreecommitdiffhomepage
path: root/mullvad-api/src
diff options
context:
space:
mode:
authorMarkus Pettersson <markus.pettersson@mullvad.net>2023-09-26 11:35:03 +0200
committerDavid Lönnhager <david.l@mullvad.net>2023-10-09 14:40:14 +0200
commit28c09203858b4d36b46a7d2c1d7af1f1fedaeb9c (patch)
tree4c07f990d90a340fcffe7508c593a6fc45fe9a81 /mullvad-api/src
parent7c9de7a434abde196da06c2e2157af71e83caa4e (diff)
downloadmullvadvpn-28c09203858b4d36b46a7d2c1d7af1f1fedaeb9c.tar.xz
mullvadvpn-28c09203858b4d36b46a7d2c1d7af1f1fedaeb9c.zip
Code cleanup
- Rename `mullvad_types::api_access.rs` -> `mullvad_types::access_method.rs` - Rename `ApiAccessMethodId` to simply `Id` Prefer to prefix with module name `access_method` to disambiguate use of `Id` instead, like `access_method::Id` - Remove dead code - Remove `AccessMethodSettingsUpdate` - Remove the `retry_attempt` struct field from `ApiConnectionModeProvider`, as it is no longer used for anything. - Fix typos - `GetApiAddressess` is now correctly spelled `GetApiAddresses` (a single trailing "s") - Deprecate the name `ApiAccessMethod` in favor of `AccessMethodSetting` - To decrease the confusion between `AccessMethod` & `ApiAccessMethod`. `AccessMethodSetting` adds some app-specific settings details on top of an `AccessMethod`, which is not too far fetched with the new naming convention. - Refactor proto file - Rename protobuf message `AccessMethodSettingAdd` to `NewAccessMethodSetting` - `AccessMethod` is now its own message - `AccessMethods` is removed - Add `ApiAccessMethodAdd` protobuf message - The `ApiAccessMethodAdd` returns a `UUID` for the . One important change is that new `AccessMethodSetting`s are created in the daemon, rather than in the CLI/other clients. This means that the daemon now has full control over generating new `AccessMethodSetting`s from `AccessMethod`s. - Clean up conversion code to/from `AccessMethod` protobuf types - Simplify `UpdateApiAccessMethod` RPC - Remove the extranous `ApiAccessMethodUpdate` data type - get rid of `ApiAccessMethodUpdate` protobuf message. Use `UUID` of `ApiAccessMethod` to identify which struct to edit. - get rid of `ApiAccessMethodUpdate` struct
Diffstat (limited to 'mullvad-api/src')
-rw-r--r--mullvad-api/src/https_client_with_sni.rs4
-rw-r--r--mullvad-api/src/proxy.rs14
2 files changed, 9 insertions, 9 deletions
diff --git a/mullvad-api/src/https_client_with_sni.rs b/mullvad-api/src/https_client_with_sni.rs
index e95fbf98fc..cc7557a8d2 100644
--- a/mullvad-api/src/https_client_with_sni.rs
+++ b/mullvad-api/src/https_client_with_sni.rs
@@ -248,12 +248,12 @@ impl TryFrom<ApiConnectionMode> for InnerConnectionMode {
})
}
ProxyConfig::Socks(config) => match config {
- mullvad_types::api_access::Socks5::Local(config) => {
+ mullvad_types::access_method::Socks5::Local(config) => {
InnerConnectionMode::Socks5(SocksConfig {
peer: SocketAddr::new("127.0.0.1".parse().unwrap(), config.port),
})
}
- mullvad_types::api_access::Socks5::Remote(config) => {
+ mullvad_types::access_method::Socks5::Remote(config) => {
InnerConnectionMode::Socks5(SocksConfig { peer: config.peer })
}
},
diff --git a/mullvad-api/src/proxy.rs b/mullvad-api/src/proxy.rs
index 7d33840d69..44a2309587 100644
--- a/mullvad-api/src/proxy.rs
+++ b/mullvad-api/src/proxy.rs
@@ -1,6 +1,6 @@
use futures::Stream;
use hyper::client::connect::Connected;
-use mullvad_types::api_access;
+use mullvad_types::access_method;
use serde::{Deserialize, Serialize};
use std::{
fmt, io,
@@ -36,8 +36,8 @@ impl fmt::Display for ApiConnectionMode {
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub enum ProxyConfig {
- Shadowsocks(api_access::Shadowsocks),
- Socks(api_access::Socks5),
+ Shadowsocks(access_method::Shadowsocks),
+ Socks(access_method::Socks5),
}
impl ProxyConfig {
@@ -46,8 +46,8 @@ impl ProxyConfig {
match self {
ProxyConfig::Shadowsocks(ss) => ss.peer,
ProxyConfig::Socks(socks) => match socks {
- api_access::Socks5::Local(s) => s.peer,
- api_access::Socks5::Remote(s) => s.peer,
+ access_method::Socks5::Local(s) => s.peer,
+ access_method::Socks5::Remote(s) => s.peer,
},
}
}
@@ -59,10 +59,10 @@ impl fmt::Display for ProxyConfig {
// TODO: Do not hardcode TCP
ProxyConfig::Shadowsocks(ss) => write!(f, "Shadowsocks {}/TCP", ss.peer),
ProxyConfig::Socks(socks) => match socks {
- api_access::Socks5::Local(s) => {
+ access_method::Socks5::Local(s) => {
write!(f, "Socks5 {}/TCP via localhost:{}", s.peer, s.port)
}
- api_access::Socks5::Remote(s) => write!(f, "Socks5 {}/TCP", s.peer),
+ access_method::Socks5::Remote(s) => write!(f, "Socks5 {}/TCP", s.peer),
},
}
}