summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls <emils@mullvad.net>2026-01-06 00:39:58 +0100
committerEmīls <emils@mullvad.net>2026-01-06 00:39:58 +0100
commitaa5447bac078fd0ec1f190ed269b585c12cfe338 (patch)
tree6310a4764c7b03cbc39458b04e41ce4533f710be
parentcc163ceebb020e39e8fc1c60fe143a68ece986b3 (diff)
downloadmullvadvpn-ios-ipv6-rebase.tar.xz
mullvadvpn-ios-ipv6-rebase.zip
fixup! Use SelectedRelay in relay selectionios-ipv6-rebase
-rw-r--r--ios/MullvadTypes/ObfuscationMethod.swift26
-rw-r--r--ios/MullvadTypes/SelectedEndpoint.swift51
2 files changed, 77 insertions, 0 deletions
diff --git a/ios/MullvadTypes/ObfuscationMethod.swift b/ios/MullvadTypes/ObfuscationMethod.swift
new file mode 100644
index 0000000000..a0b9ae4fcd
--- /dev/null
+++ b/ios/MullvadTypes/ObfuscationMethod.swift
@@ -0,0 +1,26 @@
+//
+// ObfuscationMethod.swift
+// MullvadTypes
+//
+// Created by Emīls on 2026-01-02.
+// Copyright © 2025 Mullvad VPN AB. All rights reserved.
+//
+
+import Foundation
+
+/// Describes the resolved obfuscation method with all required parameters.
+public enum ObfuscationMethod: Equatable, Codable, Sendable {
+ case off
+ case udpOverTcp
+ case shadowsocks
+ case quic(hostname: String, token: String)
+
+ public var isEnabled: Bool {
+ switch self {
+ case .off:
+ false
+ case .udpOverTcp, .shadowsocks, .quic:
+ true
+ }
+ }
+}
diff --git a/ios/MullvadTypes/SelectedEndpoint.swift b/ios/MullvadTypes/SelectedEndpoint.swift
new file mode 100644
index 0000000000..bf80a8bc2c
--- /dev/null
+++ b/ios/MullvadTypes/SelectedEndpoint.swift
@@ -0,0 +1,51 @@
+//
+// SelectedEndpoint.swift
+// MullvadTypes
+//
+// Created by Emīls on 2026-01-02.
+// Copyright © 2025 Mullvad VPN AB. All rights reserved.
+//
+
+import Foundation
+import Network
+
+/// A fully-resolved endpoint with a single socket address and bundled obfuscation info.
+///
+/// This type represents the output of relay selection, containing a resolved IP address
+/// (either IPv4 or IPv6, based on user preference) along with the obfuscation method.
+public struct SelectedEndpoint: Equatable, Codable, Sendable {
+ /// The socket address to connect to (either IPv4 or IPv6).
+ public let socketAddress: AnyIPEndpoint
+
+ /// The IPv4 gateway address for DNS resolution.
+ public let ipv4Gateway: IPv4Address
+
+ /// The IPv6 gateway address for DNS resolution.
+ public let ipv6Gateway: IPv6Address
+
+ /// The relay's WireGuard public key.
+ public let publicKey: Data
+
+ /// The obfuscation method in use, bundled with the endpoint.
+ public let obfuscation: ObfuscationMethod
+
+ public init(
+ socketAddress: AnyIPEndpoint,
+ ipv4Gateway: IPv4Address,
+ ipv6Gateway: IPv6Address,
+ publicKey: Data,
+ obfuscation: ObfuscationMethod
+ ) {
+ self.socketAddress = socketAddress
+ self.ipv4Gateway = ipv4Gateway
+ self.ipv6Gateway = ipv6Gateway
+ self.publicKey = publicKey
+ self.obfuscation = obfuscation
+ }
+}
+
+extension SelectedEndpoint: CustomDebugStringConvertible {
+ public var debugDescription: String {
+ "\(socketAddress) (obfuscation: \(obfuscation))"
+ }
+}