diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2023-08-30 13:41:43 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2023-09-05 11:27:08 +0200 |
| commit | 3bc982a60577b526901b2246a49a29ae633aa374 (patch) | |
| tree | 6f4cf94f460b18bdf064e0a66f07098194f9f536 | |
| parent | ed8eac75a4c3c66c63d7214362f59538a35ce391 (diff) | |
| download | mullvadvpn-3bc982a60577b526901b2246a49a29ae633aa374.tar.xz mullvadvpn-3bc982a60577b526901b2246a49a29ae633aa374.zip | |
Remove forwarded port from devices in Rust code
| -rw-r--r-- | mullvad-api/src/device.rs | 5 | ||||
| -rw-r--r-- | mullvad-cli/src/cmds/account.rs | 6 | ||||
| -rw-r--r-- | mullvad-daemon/src/device/mod.rs | 7 | ||||
| -rw-r--r-- | mullvad-management-interface/proto/management_interface.proto | 3 | ||||
| -rw-r--r-- | mullvad-management-interface/src/types/conversions/device.rs | 22 | ||||
| -rw-r--r-- | mullvad-types/src/device.rs | 17 |
6 files changed, 2 insertions, 58 deletions
diff --git a/mullvad-api/src/device.rs b/mullvad-api/src/device.rs index d48e1245b6..585e863ccf 100644 --- a/mullvad-api/src/device.rs +++ b/mullvad-api/src/device.rs @@ -2,7 +2,7 @@ use chrono::{DateTime, Utc}; use http::{Method, StatusCode}; use mullvad_types::{ account::AccountToken, - device::{Device, DeviceId, DeviceName, DevicePort}, + device::{Device, DeviceId, DeviceName}, }; use std::future::Future; use talpid_types::net::wireguard; @@ -23,7 +23,6 @@ struct DeviceResponse { pubkey: wireguard::PublicKey, ipv4_address: ipnetwork::Ipv4Network, ipv6_address: ipnetwork::Ipv6Network, - ports: Vec<DevicePort>, hijack_dns: bool, created: DateTime<Utc>, } @@ -73,7 +72,6 @@ impl DevicesProxy { pubkey, ipv4_address, ipv6_address, - ports, hijack_dns, created, .. @@ -84,7 +82,6 @@ impl DevicesProxy { id, name, pubkey, - ports, hijack_dns, created, }, diff --git a/mullvad-cli/src/cmds/account.rs b/mullvad-cli/src/cmds/account.rs index d0da9165fc..3b3d12b153 100644 --- a/mullvad-cli/src/cmds/account.rs +++ b/mullvad-cli/src/cmds/account.rs @@ -112,9 +112,6 @@ impl Account { println!("Device id : {}", device.device.id); println!("Device pubkey : {}", device.device.pubkey); println!("Device created : {}", device.device.created,); - for port in device.device.ports { - println!("Device port : {port}"); - } } let expiry = rpc.get_account_data(device.account_token).await?; println!( @@ -156,9 +153,6 @@ impl Account { "Created : {}", device.created.with_timezone(&chrono::Local) ); - for port in device.ports { - println!("Port : {port}"); - } } else { println!("{}", device.pretty_name()); } diff --git a/mullvad-daemon/src/device/mod.rs b/mullvad-daemon/src/device/mod.rs index b220e1e009..b54638f140 100644 --- a/mullvad-daemon/src/device/mod.rs +++ b/mullvad-daemon/src/device/mod.rs @@ -8,8 +8,7 @@ use mullvad_api::rest; use mullvad_types::{ account::{AccountToken, VoucherSubmission}, device::{ - AccountAndDevice, Device, DeviceEvent, DeviceEventCause, DeviceId, DeviceName, DevicePort, - DeviceState, + AccountAndDevice, Device, DeviceEvent, DeviceEventCause, DeviceId, DeviceName, DeviceState, }, wireguard::{self, RotationInterval, WireguardData}, }; @@ -160,7 +159,6 @@ pub struct PrivateDevice { pub id: DeviceId, pub name: DeviceName, pub wg_data: wireguard::WireguardData, - pub ports: Vec<DevicePort>, // FIXME: Reasonable default to avoid migration code for the field, // as it was previously missing. // This attribute may be removed once upgrades from `2022.2-beta1` @@ -190,7 +188,6 @@ impl PrivateDevice { id: device.id, name: device.name, wg_data, - ports: device.ports, hijack_dns: device.hijack_dns, created: device.created, }) @@ -203,7 +200,6 @@ impl PrivateDevice { return Err(Error::InvalidDevice); } self.id = device.id; - self.ports = device.ports; self.name = device.name; self.hijack_dns = device.hijack_dns; self.created = device.created; @@ -215,7 +211,6 @@ impl From<PrivateDevice> for Device { fn from(device: PrivateDevice) -> Self { Device { id: device.id, - ports: device.ports, pubkey: device.wg_data.private_key.public_key(), name: device.name, hijack_dns: device.hijack_dns, diff --git a/mullvad-management-interface/proto/management_interface.proto b/mullvad-management-interface/proto/management_interface.proto index 4fdff3e75c..7b0f5144ff 100644 --- a/mullvad-management-interface/proto/management_interface.proto +++ b/mullvad-management-interface/proto/management_interface.proto @@ -622,13 +622,10 @@ message Device { string id = 1; string name = 2; bytes pubkey = 3; - repeated DevicePort ports = 4; bool hijack_dns = 5; google.protobuf.Timestamp created = 6; } -message DevicePort { string id = 1; } - message DeviceList { repeated Device devices = 1; } message DeviceRemoval { diff --git a/mullvad-management-interface/src/types/conversions/device.rs b/mullvad-management-interface/src/types/conversions/device.rs index 12ae5b0434..faa97b8ab0 100644 --- a/mullvad-management-interface/src/types/conversions/device.rs +++ b/mullvad-management-interface/src/types/conversions/device.rs @@ -9,11 +9,6 @@ impl TryFrom<proto::Device> for mullvad_types::device::Device { id: device.id, name: device.name, pubkey: bytes_to_pubkey(&device.pubkey)?, - ports: device - .ports - .into_iter() - .map(mullvad_types::device::DevicePort::from) - .collect(), hijack_dns: device.hijack_dns, created: chrono::DateTime::from_utc( chrono::NaiveDateTime::from_timestamp_opt( @@ -38,11 +33,6 @@ impl From<mullvad_types::device::Device> for proto::Device { id: device.id, name: device.name, pubkey: device.pubkey.as_bytes().to_vec(), - ports: device - .ports - .into_iter() - .map(proto::DevicePort::from) - .collect(), hijack_dns: device.hijack_dns, created: Some(Timestamp { seconds: device.created.timestamp(), @@ -86,12 +76,6 @@ impl TryFrom<proto::DeviceState> for mullvad_types::device::DeviceState { } } -impl From<mullvad_types::device::DevicePort> for proto::DevicePort { - fn from(port: mullvad_types::device::DevicePort) -> Self { - proto::DevicePort { id: port.id } - } -} - impl From<mullvad_types::device::DeviceState> for proto::DeviceState { fn from(state: mullvad_types::device::DeviceState) -> Self { proto::DeviceState { @@ -211,9 +195,3 @@ impl From<Vec<mullvad_types::device::Device>> for proto::DeviceList { } } } - -impl From<proto::DevicePort> for mullvad_types::device::DevicePort { - fn from(port: proto::DevicePort) -> Self { - mullvad_types::device::DevicePort { id: port.id } - } -} diff --git a/mullvad-types/src/device.rs b/mullvad-types/src/device.rs index f21d890eca..bc066ecf22 100644 --- a/mullvad-types/src/device.rs +++ b/mullvad-types/src/device.rs @@ -3,7 +3,6 @@ use chrono::{DateTime, Utc}; #[cfg(target_os = "android")] use jnix::IntoJava; use serde::{Deserialize, Serialize}; -use std::fmt; use talpid_types::net::wireguard::PublicKey; /// UUID for a device. @@ -21,7 +20,6 @@ pub struct Device { pub name: DeviceName, #[cfg_attr(target_os = "android", jnix(map = "|key| *key.as_bytes()"))] pub pubkey: PublicKey, - pub ports: Vec<DevicePort>, #[cfg_attr(target_os = "android", jnix(skip))] pub hijack_dns: bool, #[cfg_attr(target_os = "android", jnix(map = "|expiry| expiry.to_string()"))] @@ -49,21 +47,6 @@ impl Device { } } -/// Ports associated with a device. -#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] -#[cfg_attr(target_os = "android", derive(IntoJava))] -#[cfg_attr(target_os = "android", jnix(package = "net.mullvad.mullvadvpn.model"))] -pub struct DevicePort { - /// Port identifier. - pub id: String, -} - -impl fmt::Display for DevicePort { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", self.id) - } -} - /// Contains a device state. #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(rename_all = "snake_case")] |
