summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ios/MullvadTypes/RelayConstraints.swift10
1 files changed, 10 insertions, 0 deletions
diff --git a/ios/MullvadTypes/RelayConstraints.swift b/ios/MullvadTypes/RelayConstraints.swift
index 22a84aea0e..9b32fdf16e 100644
--- a/ios/MullvadTypes/RelayConstraints.swift
+++ b/ios/MullvadTypes/RelayConstraints.swift
@@ -10,6 +10,8 @@ import Foundation
public struct RelayConstraints: Codable, Equatable, CustomDebugStringConvertible {
public var location: RelayConstraint<RelayLocation>
+
+ // Added in 2023.3
public var port: RelayConstraint<UInt16>
public var debugDescription: String {
@@ -23,4 +25,12 @@ public struct RelayConstraints: Codable, Equatable, CustomDebugStringConvertible
self.location = location
self.port = port
}
+
+ public init(from decoder: Decoder) throws {
+ let container = try decoder.container(keyedBy: CodingKeys.self)
+ location = try container.decode(RelayConstraint<RelayLocation>.self, forKey: .location)
+
+ // Added in 2023.3
+ port = try container.decodeIfPresent(RelayConstraint<UInt16>.self, forKey: .port) ?? .any
+ }
}