summaryrefslogtreecommitdiffhomepage
path: root/android/lib
diff options
context:
space:
mode:
authorDavid Göransson <david.goransson@mullvad.net>2025-07-16 09:17:45 +0200
committerDavid Lönnhager <david.l@mullvad.net>2025-07-23 09:41:54 +0200
commitbb4b111acc09a92fdf12e0fc6d504180f91421c8 (patch)
tree631225900359f14962359923f4c8f7c9bbcc9a59 /android/lib
parent50936e756abb825757bc539dacfadb6640792fae (diff)
downloadmullvadvpn-bb4b111acc09a92fdf12e0fc6d504180f91421c8.tar.xz
mullvadvpn-bb4b111acc09a92fdf12e0fc6d504180f91421c8.zip
Support new features message on Android
Diffstat (limited to 'android/lib')
-rw-r--r--android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt14
-rw-r--r--android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayItem.kt7
-rw-r--r--android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/relaylist/RelayItemPreviewData.kt3
3 files changed, 16 insertions, 8 deletions
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 02609da2f8..081b11f50c 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,6 +42,7 @@ 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
@@ -595,12 +596,13 @@ internal fun ManagementInterface.Relay.toDomain(
active = active,
provider = ProviderId(provider),
ownership = if (owned) Ownership.MullvadOwned else Ownership.Rented,
- daita =
- if (
- hasEndpointData() && endpointType == ManagementInterface.Relay.RelayType.WIREGUARD
- ) {
- ManagementInterface.WireguardRelayEndpointData.parseFrom(endpointData.value).daita
- } else false,
+ features = features.toDomain(),
+ )
+
+internal fun ManagementInterface.Relay.Features.toDomain(): Features =
+ Features(
+ daita = daita,
+ quic = null, // Not supported on Android
)
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 27ce80c016..d4cadf0e6a 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,6 +1,7 @@
package net.mullvad.mullvadvpn.lib.model
import arrow.optics.optics
+import java.net.InetAddress
typealias DomainCustomList = CustomList
@@ -84,7 +85,7 @@ sealed interface RelayItem {
val provider: ProviderId,
val ownership: Ownership,
override val active: Boolean,
- val daita: Boolean,
+ val features: Features,
) : Location {
override val name: String = id.code
override val hasChildren: Boolean = false
@@ -97,3 +98,7 @@ 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 35397a6a27..712f093acf 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,5 +1,6 @@
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
@@ -50,7 +51,7 @@ private fun generateRelayItemRelay(
active = active,
provider = ProviderId("Provider"),
ownership = Ownership.MullvadOwned,
- daita = daita,
+ features = Features(daita = daita, quic = null),
)
private fun String.generateCountryCode() =