diff options
| author | David Göransson <david.goransson@mullvad.net> | 2025-07-18 10:50:27 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2025-07-23 09:41:54 +0200 |
| commit | d3cae0e103010bb620340068e7337606fd78a9ee (patch) | |
| tree | 9692eeb2f8a84f8fcf80caaee26b9c435a3eed3e | |
| parent | 38b8388e06b0fd60c3e4e6aa351eb541329dd3dd (diff) | |
| download | mullvadvpn-d3cae0e103010bb620340068e7337606fd78a9ee.tar.xz mullvadvpn-d3cae0e103010bb620340068e7337606fd78a9ee.zip | |
Update to new protobuf protocol
4 files changed, 12 insertions, 33 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayItemExtensions.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayItemExtensions.kt index 21ef30408c..4803b966a9 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayItemExtensions.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayItemExtensions.kt @@ -95,23 +95,16 @@ private fun RelayItem.Location.City.filter( } } -private fun RelayItem.Location.Relay.hasMatchingDaitaSetting(filterDaita: Boolean): Boolean { - return if (filterDaita) features.daita else true -} +private fun RelayItem.Location.Relay.hasMatchingDaitaSetting(filterDaita: Boolean): Boolean = + if (filterDaita) daita else true private fun RelayItem.Location.Relay.filter( ownership: Constraint<Ownership>, providers: Constraint<Providers>, daita: Boolean, -): RelayItem.Location.Relay? { - return if ( - hasMatchingDaitaSetting(daita) && hasOwnership(ownership) && hasProvider(providers) - ) { - this - } else { - null - } -} +): RelayItem.Location.Relay? = + if (hasMatchingDaitaSetting(daita) && hasOwnership(ownership) && hasProvider(providers)) this + else null fun List<RelayItem.Location.Country>.findByGeoLocationId( geoLocationId: GeoLocationId diff --git a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt index 081b11f50c..140cf5aafb 100644 --- a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt +++ b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt @@ -42,7 +42,6 @@ import net.mullvad.mullvadvpn.lib.model.Endpoint import net.mullvad.mullvadvpn.lib.model.ErrorState import net.mullvad.mullvadvpn.lib.model.ErrorStateCause import net.mullvad.mullvadvpn.lib.model.FeatureIndicator -import net.mullvad.mullvadvpn.lib.model.Features import net.mullvad.mullvadvpn.lib.model.GenericOptions import net.mullvad.mullvadvpn.lib.model.GeoIpLocation import net.mullvad.mullvadvpn.lib.model.GeoLocationId @@ -80,7 +79,6 @@ import net.mullvad.mullvadvpn.lib.model.TunnelState import net.mullvad.mullvadvpn.lib.model.Udp2TcpObfuscationSettings import net.mullvad.mullvadvpn.lib.model.WireguardConstraints import net.mullvad.mullvadvpn.lib.model.WireguardEndpointData -import net.mullvad.mullvadvpn.lib.model.WireguardRelayEndpointData import net.mullvad.mullvadvpn.lib.model.WireguardTunnelOptions internal fun ManagementInterface.TunnelState.toDomain(): TunnelState = @@ -545,9 +543,6 @@ internal fun ManagementInterface.WireguardEndpointData.toDomain(): WireguardEndp shadowsocksPortRangesList.map { it.toDomain() }, ) -internal fun ManagementInterface.WireguardRelayEndpointData.toDomain(): WireguardRelayEndpointData = - WireguardRelayEndpointData(daita) - internal fun ManagementInterface.PortRange.toDomain(): PortRange = PortRange(first..last) /** @@ -582,7 +577,7 @@ internal fun ManagementInterface.RelayListCity.toDomain( id = cityCode, relays = relaysList - .filter { it.endpointType == ManagementInterface.Relay.RelayType.WIREGUARD } + .filter { it.endpointData.hasWireguard() } .map { it.toDomain(cityCode) } .sortedWith(RelayNameComparator), ) @@ -596,13 +591,8 @@ internal fun ManagementInterface.Relay.toDomain( active = active, provider = ProviderId(provider), ownership = if (owned) Ownership.MullvadOwned else Ownership.Rented, - features = features.toDomain(), - ) - -internal fun ManagementInterface.Relay.Features.toDomain(): Features = - Features( - daita = daita, - quic = null, // Not supported on Android + daita = endpointData.wireguard.daita, + quic = endpointData.wireguard.hasQuic(), ) private fun Instant.atDefaultZone() = atZone(ZoneId.systemDefault()) diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayItem.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayItem.kt index d4cadf0e6a..b1df67fea6 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayItem.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayItem.kt @@ -1,7 +1,6 @@ package net.mullvad.mullvadvpn.lib.model import arrow.optics.optics -import java.net.InetAddress typealias DomainCustomList = CustomList @@ -85,7 +84,8 @@ sealed interface RelayItem { val provider: ProviderId, val ownership: Ownership, override val active: Boolean, - val features: Features, + val daita: Boolean, + val quic: Boolean, ) : Location { override val name: String = id.code override val hasChildren: Boolean = false @@ -98,7 +98,3 @@ sealed interface RelayItem { companion object } - -data class Features(val daita: Boolean, val quic: Quic?) - -data class Quic(val domain: String, val token: String, val addrIn: List<InetAddress>) diff --git a/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/relaylist/RelayItemPreviewData.kt b/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/relaylist/RelayItemPreviewData.kt index 712f093acf..724c567595 100644 --- a/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/relaylist/RelayItemPreviewData.kt +++ b/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/relaylist/RelayItemPreviewData.kt @@ -1,6 +1,5 @@ package net.mullvad.mullvadvpn.lib.ui.component.relaylist -import net.mullvad.mullvadvpn.lib.model.Features import net.mullvad.mullvadvpn.lib.model.GeoLocationId import net.mullvad.mullvadvpn.lib.model.Ownership import net.mullvad.mullvadvpn.lib.model.ProviderId @@ -51,7 +50,8 @@ private fun generateRelayItemRelay( active = active, provider = ProviderId("Provider"), ownership = Ownership.MullvadOwned, - features = Features(daita = daita, quic = null), + daita = daita, + quic = false, ) private fun String.generateCountryCode() = |
