diff options
| author | Jon Petersson <jon.petersson@kvadrat.se> | 2024-09-19 14:52:06 +0200 |
|---|---|---|
| committer | Jon Petersson <jon.petersson@kvadrat.se> | 2024-09-23 15:43:10 +0200 |
| commit | a2007d2b5a6d48087b2a3ee013a0eb2bd56e0596 (patch) | |
| tree | 0611528ccd05c6063e11f0c35f2c429966f64585 | |
| parent | 0495209971d2e8cbd4886857f10681c47100a516 (diff) | |
| download | mullvadvpn-fix-compiler-concurrency-issues-for-level-targeted-ios-828.tar.xz mullvadvpn-fix-compiler-concurrency-issues-for-level-targeted-ios-828.zip | |
Fix compiler concurrency warnings, targeted levelfix-compiler-concurrency-issues-for-level-targeted-ios-828
38 files changed, 67 insertions, 67 deletions
diff --git a/ios/MullvadREST/Relay/RelaySelectorProtocol.swift b/ios/MullvadREST/Relay/RelaySelectorProtocol.swift index 92d48a8239..d7070055e7 100644 --- a/ios/MullvadREST/Relay/RelaySelectorProtocol.swift +++ b/ios/MullvadREST/Relay/RelaySelectorProtocol.swift @@ -19,7 +19,7 @@ public protocol RelaySelectorProtocol { } /// Struct describing the selected relay. -public struct SelectedRelay: Equatable, Codable { +public struct SelectedRelay: Equatable, Codable, Sendable { /// Selected relay endpoint. public let endpoint: MullvadEndpoint @@ -43,7 +43,7 @@ extension SelectedRelay: CustomDebugStringConvertible { } } -public struct SelectedRelays: Equatable, Codable { +public struct SelectedRelays: Equatable, Codable, Sendable { public let entry: SelectedRelay? public let exit: SelectedRelay public let retryAttempt: UInt diff --git a/ios/MullvadTypes/AnyIPEndpoint.swift b/ios/MullvadTypes/AnyIPEndpoint.swift index cf294c7028..e90976a331 100644 --- a/ios/MullvadTypes/AnyIPEndpoint.swift +++ b/ios/MullvadTypes/AnyIPEndpoint.swift @@ -9,7 +9,7 @@ import Foundation import protocol Network.IPAddress -public enum AnyIPEndpoint: Hashable, Equatable, Codable, CustomStringConvertible { +public enum AnyIPEndpoint: Hashable, Equatable, Codable, CustomStringConvertible, Sendable { case ipv4(IPv4Endpoint) case ipv6(IPv6Endpoint) diff --git a/ios/MullvadTypes/Cancellable.swift b/ios/MullvadTypes/Cancellable.swift index 8f658a6da1..0bfd93825c 100644 --- a/ios/MullvadTypes/Cancellable.swift +++ b/ios/MullvadTypes/Cancellable.swift @@ -15,11 +15,11 @@ public protocol Cancellable { extension Operation: Cancellable {} /// An object representing a cancellation token. -public final class AnyCancellable: Cancellable { - private let block: (() -> Void)? +public final class AnyCancellable: Cancellable, Sendable { + private let block: (@Sendable () -> Void)? /// Create cancellation token with block handler. - public init(block: @escaping () -> Void) { + public init(block: @Sendable @escaping () -> Void) { self.block = block } diff --git a/ios/MullvadTypes/IPv4Endpoint.swift b/ios/MullvadTypes/IPv4Endpoint.swift index c0ed1e4771..2e771aaa33 100644 --- a/ios/MullvadTypes/IPv4Endpoint.swift +++ b/ios/MullvadTypes/IPv4Endpoint.swift @@ -9,7 +9,7 @@ import Foundation import Network -public struct IPv4Endpoint: Hashable, Equatable, Codable, CustomStringConvertible { +public struct IPv4Endpoint: Hashable, Equatable, Codable, CustomStringConvertible, Sendable { public let ip: IPv4Address public let port: UInt16 diff --git a/ios/MullvadTypes/IPv6Endpoint.swift b/ios/MullvadTypes/IPv6Endpoint.swift index 5dd56a4982..e65ce0f225 100644 --- a/ios/MullvadTypes/IPv6Endpoint.swift +++ b/ios/MullvadTypes/IPv6Endpoint.swift @@ -9,7 +9,7 @@ import Foundation import Network -public struct IPv6Endpoint: Hashable, Equatable, Codable, CustomStringConvertible { +public struct IPv6Endpoint: Hashable, Equatable, Codable, CustomStringConvertible, Sendable { public let ip: IPv6Address public let port: UInt16 diff --git a/ios/MullvadTypes/Location.swift b/ios/MullvadTypes/Location.swift index 13cf935425..5084541220 100644 --- a/ios/MullvadTypes/Location.swift +++ b/ios/MullvadTypes/Location.swift @@ -9,7 +9,7 @@ import CoreLocation import Foundation -public struct Location: Codable, Equatable { +public struct Location: Codable, Equatable, Sendable { public var country: String public var countryCode: String public var city: String diff --git a/ios/MullvadTypes/MullvadEndpoint.swift b/ios/MullvadTypes/MullvadEndpoint.swift index 9c05111c8c..7d11fdd11b 100644 --- a/ios/MullvadTypes/MullvadEndpoint.swift +++ b/ios/MullvadTypes/MullvadEndpoint.swift @@ -10,7 +10,7 @@ import Foundation import Network /// Contains server data needed to connect to a single mullvad endpoint. -public struct MullvadEndpoint: Equatable, Codable { +public struct MullvadEndpoint: Equatable, Codable, Sendable { public let ipv4Relay: IPv4Endpoint public let ipv6Relay: IPv6Endpoint? public let ipv4Gateway: IPv4Address diff --git a/ios/MullvadTypes/RelayConstraint.swift b/ios/MullvadTypes/RelayConstraint.swift index 189bee9568..dea997e7f5 100644 --- a/ios/MullvadTypes/RelayConstraint.swift +++ b/ios/MullvadTypes/RelayConstraint.swift @@ -10,7 +10,7 @@ import Foundation private let anyConstraint = "any" -public enum RelayConstraint<T>: Codable, Equatable, +public enum RelayConstraint<T: Sendable>: Codable, Equatable, Sendable, CustomDebugStringConvertible where T: Codable & Equatable { case any case only(T) diff --git a/ios/MullvadTypes/RelayConstraints.swift b/ios/MullvadTypes/RelayConstraints.swift index b6396767d8..18241e0958 100644 --- a/ios/MullvadTypes/RelayConstraints.swift +++ b/ios/MullvadTypes/RelayConstraints.swift @@ -8,7 +8,7 @@ import Foundation -public struct RelayConstraints: Codable, Equatable, CustomDebugStringConvertible { +public struct RelayConstraints: Codable, Equatable, CustomDebugStringConvertible, Sendable { @available(*, deprecated, renamed: "locations") private var location: RelayConstraint<RelayLocation> = .only(.country("se")) diff --git a/ios/MullvadTypes/RelayFilter.swift b/ios/MullvadTypes/RelayFilter.swift index 48b5c0a326..73a48d7b90 100644 --- a/ios/MullvadTypes/RelayFilter.swift +++ b/ios/MullvadTypes/RelayFilter.swift @@ -8,8 +8,8 @@ import Foundation -public struct RelayFilter: Codable, Equatable { - public enum Ownership: Codable { +public struct RelayFilter: Codable, Equatable, Sendable { + public enum Ownership: Codable, Sendable { case any case owned case rented diff --git a/ios/MullvadTypes/RelayLocation.swift b/ios/MullvadTypes/RelayLocation.swift index 279f3cb6bc..b2ef8fa954 100644 --- a/ios/MullvadTypes/RelayLocation.swift +++ b/ios/MullvadTypes/RelayLocation.swift @@ -8,7 +8,7 @@ import Foundation -public enum RelayLocation: Codable, Hashable, CustomDebugStringConvertible { +public enum RelayLocation: Codable, Hashable, CustomDebugStringConvertible, Sendable { case country(String) case city(String, String) case hostname(String, String, String) @@ -107,7 +107,7 @@ public enum RelayLocation: Codable, Hashable, CustomDebugStringConvertible { } } -public struct UserSelectedRelays: Codable, Equatable { +public struct UserSelectedRelays: Codable, Equatable, Sendable { public let locations: [RelayLocation] public let customListSelection: CustomListSelection? @@ -118,7 +118,7 @@ public struct UserSelectedRelays: Codable, Equatable { } extension UserSelectedRelays { - public struct CustomListSelection: Codable, Equatable { + public struct CustomListSelection: Codable, Equatable, Sendable { /// The ID of the custom list that the selected relays belong to. public let listId: UUID /// Whether the selected relays are subnodes or the custom list itself. diff --git a/ios/MullvadTypes/TransportLayer.swift b/ios/MullvadTypes/TransportLayer.swift index b4a7e6c3cd..cb25c72490 100644 --- a/ios/MullvadTypes/TransportLayer.swift +++ b/ios/MullvadTypes/TransportLayer.swift @@ -8,7 +8,7 @@ import Foundation -public enum TransportLayer: Codable { +public enum TransportLayer: Codable, Sendable { case udp case tcp } diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj index eaac38f689..81f04b80e4 100644 --- a/ios/MullvadVPN.xcodeproj/project.pbxproj +++ b/ios/MullvadVPN.xcodeproj/project.pbxproj @@ -6664,7 +6664,7 @@ SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_STRICT_CONCURRENCY = minimal; + SWIFT_STRICT_CONCURRENCY = targeted; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -6704,7 +6704,7 @@ SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_STRICT_CONCURRENCY = minimal; + SWIFT_STRICT_CONCURRENCY = targeted; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -6810,7 +6810,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_PRECOMPILE_BRIDGING_HEADER = NO; - SWIFT_STRICT_CONCURRENCY = minimal; + SWIFT_STRICT_CONCURRENCY = targeted; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -6869,7 +6869,7 @@ SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_PRECOMPILE_BRIDGING_HEADER = NO; - SWIFT_STRICT_CONCURRENCY = minimal; + SWIFT_STRICT_CONCURRENCY = targeted; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -7514,7 +7514,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_PRECOMPILE_BRIDGING_HEADER = NO; - SWIFT_STRICT_CONCURRENCY = minimal; + SWIFT_STRICT_CONCURRENCY = targeted; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -7819,7 +7819,7 @@ SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_STRICT_CONCURRENCY = minimal; + SWIFT_STRICT_CONCURRENCY = targeted; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -8356,7 +8356,7 @@ SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; SWIFT_PRECOMPILE_BRIDGING_HEADER = NO; - SWIFT_STRICT_CONCURRENCY = minimal; + SWIFT_STRICT_CONCURRENCY = targeted; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -8657,7 +8657,7 @@ SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_STRICT_CONCURRENCY = minimal; + SWIFT_STRICT_CONCURRENCY = targeted; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; diff --git a/ios/PacketTunnel/PacketTunnelProvider/PacketTunnelPathObserver.swift b/ios/PacketTunnel/PacketTunnelProvider/PacketTunnelPathObserver.swift index 56953553dd..8a76989010 100644 --- a/ios/PacketTunnel/PacketTunnelProvider/PacketTunnelPathObserver.swift +++ b/ios/PacketTunnel/PacketTunnelProvider/PacketTunnelPathObserver.swift @@ -51,4 +51,4 @@ final class PacketTunnelPathObserver: DefaultPathObserverProtocol { } } -extension NetworkExtension.NWPath: NetworkPath {} +extension NetworkExtension.NWPath: @retroactive NetworkPath, @unchecked Sendable {} diff --git a/ios/PacketTunnel/WireGuardAdapter/WgAdapter.swift b/ios/PacketTunnel/WireGuardAdapter/WgAdapter.swift index dd2d562c2e..7e8eb7f133 100644 --- a/ios/PacketTunnel/WireGuardAdapter/WgAdapter.swift +++ b/ios/PacketTunnel/WireGuardAdapter/WgAdapter.swift @@ -7,11 +7,11 @@ // import Foundation -import MullvadLogging +@preconcurrency import MullvadLogging import MullvadTypes import NetworkExtension import PacketTunnelCore -import WireGuardKit +@preconcurrency import WireGuardKit struct WgAdapter: TunnelAdapterProtocol { let logger = Logger(label: "WgAdapter") diff --git a/ios/PacketTunnelCore/Actor/EphemeralPeerNegotiationState.swift b/ios/PacketTunnelCore/Actor/EphemeralPeerNegotiationState.swift index 339e458ce2..1a06a82f27 100644 --- a/ios/PacketTunnelCore/Actor/EphemeralPeerNegotiationState.swift +++ b/ios/PacketTunnelCore/Actor/EphemeralPeerNegotiationState.swift @@ -7,9 +7,9 @@ // import MullvadREST -import WireGuardKitTypes +@preconcurrency import WireGuardKitTypes -public enum EphemeralPeerNegotiationState: Equatable { +public enum EphemeralPeerNegotiationState: Equatable, Sendable { case single(EphemeralPeerRelayConfiguration) case multi(entry: EphemeralPeerRelayConfiguration, exit: EphemeralPeerRelayConfiguration) @@ -25,7 +25,7 @@ public enum EphemeralPeerNegotiationState: Equatable { } } -public struct EphemeralPeerRelayConfiguration: Equatable, CustomDebugStringConvertible { +public struct EphemeralPeerRelayConfiguration: Equatable, CustomDebugStringConvertible, Sendable { public let relay: SelectedRelay public let configuration: EphemeralPeerConfiguration @@ -39,7 +39,7 @@ public struct EphemeralPeerRelayConfiguration: Equatable, CustomDebugStringConve } } -public struct EphemeralPeerConfiguration: Equatable, CustomDebugStringConvertible { +public struct EphemeralPeerConfiguration: Equatable, CustomDebugStringConvertible, Sendable { public let privateKey: PrivateKey public let preSharedKey: PreSharedKey? public let allowedIPs: [IPAddressRange] diff --git a/ios/PacketTunnelCore/Actor/ObservedState.swift b/ios/PacketTunnelCore/Actor/ObservedState.swift index 8b3779284e..16c4b08f9d 100644 --- a/ios/PacketTunnelCore/Actor/ObservedState.swift +++ b/ios/PacketTunnelCore/Actor/ObservedState.swift @@ -11,10 +11,10 @@ import Foundation import MullvadREST import MullvadTypes import Network -import WireGuardKitTypes +@preconcurrency import WireGuardKitTypes /// A serializable representation of internal state. -public enum ObservedState: Equatable, Codable { +public enum ObservedState: Equatable, Codable, Sendable { case initial case connecting(ObservedConnectionState) case reconnecting(ObservedConnectionState) @@ -26,7 +26,7 @@ public enum ObservedState: Equatable, Codable { } /// A serializable representation of internal connection state. -public struct ObservedConnectionState: Equatable, Codable { +public struct ObservedConnectionState: Equatable, Codable, Sendable { public var selectedRelays: SelectedRelays public var relayConstraints: RelayConstraints public var networkReachability: NetworkReachability @@ -65,7 +65,7 @@ public struct ObservedConnectionState: Equatable, Codable { } /// A serializable representation of internal blocked state. -public struct ObservedBlockedState: Equatable, Codable { +public struct ObservedBlockedState: Equatable, Codable, Sendable { public var reason: BlockedStateReason public var relayConstraints: RelayConstraints? diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActor+ConnectionMonitoring.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActor+ConnectionMonitoring.swift index 4c53a977b3..e6f2411d4e 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActor+ConnectionMonitoring.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActor+ConnectionMonitoring.swift @@ -1,5 +1,5 @@ // -// Actor+ConnectionMonitoring.swift +// PacketTunnelActor+ConnectionMonitoring.swift // PacketTunnelCore // // Created by pronebird on 26/09/2023. diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift index 064445ff1e..d975801c6e 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift @@ -9,7 +9,7 @@ import Foundation import MullvadTypes import Network -import WireGuardKitTypes +@preconcurrency import WireGuardKitTypes extension PacketTunnelActor { /** diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActor+Extensions.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActor+Extensions.swift index 3610c3ff50..d189e45bfa 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActor+Extensions.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActor+Extensions.swift @@ -6,6 +6,7 @@ // Copyright © 2023 Mullvad VPN AB. All rights reserved. // +@preconcurrency import Combine import Foundation extension PacketTunnelActor { diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActor+PostQuantum.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActor+PostQuantum.swift index 3b3c5ad560..acaf205ab5 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActor+PostQuantum.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActor+PostQuantum.swift @@ -7,7 +7,7 @@ // import Foundation -import WireGuardKitTypes +@preconcurrency import WireGuardKitTypes extension PacketTunnelActor { /** diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActor+SleepCycle.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActor+SleepCycle.swift index c6339ce11e..f3e420ae97 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActor+SleepCycle.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActor+SleepCycle.swift @@ -1,5 +1,5 @@ // -// Actor+SleepCycle.swift +// PacketTunnelActor+SleepCycle.swift // PacketTunnelCore // // Created by pronebird on 26/09/2023. diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActor.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActor.swift index 98dbeea262..218c3c8eaa 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActor.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActor.swift @@ -7,13 +7,13 @@ // import Foundation -import MullvadLogging +@preconcurrency import MullvadLogging import MullvadREST import MullvadRustRuntime import MullvadSettings import MullvadTypes import NetworkExtension -import WireGuardKitTypes +@preconcurrency import WireGuardKitTypes /** Packet tunnel state machine implemented as an actor. diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActorCommand.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActorCommand.swift index b677986d04..38dcd0ba42 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActorCommand.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActorCommand.swift @@ -11,7 +11,7 @@ import WireGuardKitTypes extension PacketTunnelActor { /// Describes events that the state machine handles. These can be user commands or non-user-initiated events - enum Event { + enum Event: Sendable { /// Start tunnel. case start(StartOptions) diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActorReducer.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActorReducer.swift index 3382baf209..ac9ff300ab 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActorReducer.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActorReducer.swift @@ -11,7 +11,7 @@ import WireGuardKitTypes extension PacketTunnelActor { /// A structure encoding an effect; each event will yield zero or more of those, which can then be sequentially executed. - enum Effect: Equatable { + enum Effect: Equatable, Sendable { case startDefaultPathObserver case stopDefaultPathObserver case startTunnelMonitor diff --git a/ios/PacketTunnelCore/Actor/Protocols/TunnelAdapterProtocol.swift b/ios/PacketTunnelCore/Actor/Protocols/TunnelAdapterProtocol.swift index ac992c76c9..d1a93dae52 100644 --- a/ios/PacketTunnelCore/Actor/Protocols/TunnelAdapterProtocol.swift +++ b/ios/PacketTunnelCore/Actor/Protocols/TunnelAdapterProtocol.swift @@ -9,11 +9,10 @@ import Foundation import MullvadTypes import Network - -import WireGuardKitTypes +@preconcurrency import WireGuardKitTypes /// Protocol describing interface for any kind of adapter implementing a VPN tunnel. -public protocol TunnelAdapterProtocol { +public protocol TunnelAdapterProtocol: Sendable { /// Start tunnel adapter or update active configuration. func start(configuration: TunnelAdapterConfiguration, daita: DaitaConfiguration?) async throws @@ -29,7 +28,7 @@ public protocol TunnelAdapterProtocol { } /// Struct describing tunnel adapter configuration. -public struct TunnelAdapterConfiguration { +public struct TunnelAdapterConfiguration: Sendable { public var privateKey: PrivateKey public var interfaceAddresses: [IPAddressRange] public var dns: [IPAddress] @@ -38,7 +37,7 @@ public struct TunnelAdapterConfiguration { } /// Struct describing a single peer. -public struct TunnelPeer { +public struct TunnelPeer: Sendable { public var endpoint: AnyIPEndpoint public var publicKey: PublicKey public var preSharedKey: PreSharedKey? diff --git a/ios/PacketTunnelCore/Actor/StartOptions.swift b/ios/PacketTunnelCore/Actor/StartOptions.swift index 9af92fe34c..25e38e93b3 100644 --- a/ios/PacketTunnelCore/Actor/StartOptions.swift +++ b/ios/PacketTunnelCore/Actor/StartOptions.swift @@ -10,7 +10,7 @@ import Foundation import MullvadREST /// Packet tunnel start options parsed from dictionary passed to packet tunnel with a call to `startTunnel()`. -public struct StartOptions { +public struct StartOptions: Sendable { /// The system that triggered the launch of packet tunnel. public var launchSource: LaunchSource @@ -36,7 +36,7 @@ public struct StartOptions { } /// The source facility that triggered a launch of packet tunnel extension. -public enum LaunchSource: String, CustomStringConvertible { +public enum LaunchSource: String, CustomStringConvertible, Sendable { /// Launched by the main bundle app using network extension framework. case app diff --git a/ios/PacketTunnelCore/Actor/State.swift b/ios/PacketTunnelCore/Actor/State.swift index 10a28b5a24..dd6b3e342f 100644 --- a/ios/PacketTunnelCore/Actor/State.swift +++ b/ios/PacketTunnelCore/Actor/State.swift @@ -87,7 +87,7 @@ enum State: Equatable { } /// Enum describing network availability. -public enum NetworkReachability: Equatable, Codable { +public enum NetworkReachability: Equatable, Codable, Sendable { case undetermined, reachable, unreachable } @@ -188,7 +188,7 @@ extension State { } /// Reason why packet tunnel entered error state. -public enum BlockedStateReason: String, Codable, Equatable { +public enum BlockedStateReason: String, Codable, Equatable, Sendable { /// Device is locked. case deviceLocked @@ -241,7 +241,7 @@ extension State.BlockingData { } /// Describes which relay the tunnel should connect to next. -public enum NextRelays: Equatable, Codable { +public enum NextRelays: Equatable, Codable, Sendable { /// Select next relays randomly. case random @@ -253,7 +253,7 @@ public enum NextRelays: Equatable, Codable { } /// Describes the reason for reconnection request. -public enum ActorReconnectReason: Equatable { +public enum ActorReconnectReason: Equatable, Sendable { /// Initiated by user. case userInitiated diff --git a/ios/PacketTunnelCore/Actor/Task+Duration.swift b/ios/PacketTunnelCore/Actor/Task+Duration.swift index 46e90bd196..a4453199cd 100644 --- a/ios/PacketTunnelCore/Actor/Task+Duration.swift +++ b/ios/PacketTunnelCore/Actor/Task+Duration.swift @@ -1,5 +1,5 @@ // -// Task+.swift +// Task+Duration.swift // PacketTunnelCore // // Created by pronebird on 11/09/2023. diff --git a/ios/PacketTunnelCore/Actor/Timings.swift b/ios/PacketTunnelCore/Actor/Timings.swift index 5a62f7b058..947bbaf4a8 100644 --- a/ios/PacketTunnelCore/Actor/Timings.swift +++ b/ios/PacketTunnelCore/Actor/Timings.swift @@ -10,7 +10,7 @@ import Foundation import MullvadTypes /// Struct holding all timings used by tunnel actor. -public struct PacketTunnelActorTimings { +public struct PacketTunnelActorTimings: Sendable { /// Periodicity at which actor will attempt to restart when an error occurred on system boot when filesystem is locked until device is unlocked or tunnel adapter error. public var bootRecoveryPeriodicity: Duration diff --git a/ios/PacketTunnelCore/Pinger/Pinger.swift b/ios/PacketTunnelCore/Pinger/Pinger.swift index 69ae1ab5af..c531c13db7 100644 --- a/ios/PacketTunnelCore/Pinger/Pinger.swift +++ b/ios/PacketTunnelCore/Pinger/Pinger.swift @@ -12,7 +12,7 @@ import Network // This is the legacy Pinger using native TCP/IP networking. /// ICMP client. -public final class Pinger: PingerProtocol { +public final class Pinger: PingerProtocol, @unchecked Sendable { // Socket read buffer size. private static let bufferSize = 65535 diff --git a/ios/PacketTunnelCore/Pinger/PingerProtocol.swift b/ios/PacketTunnelCore/Pinger/PingerProtocol.swift index 67c64c1448..16b02e614f 100644 --- a/ios/PacketTunnelCore/Pinger/PingerProtocol.swift +++ b/ios/PacketTunnelCore/Pinger/PingerProtocol.swift @@ -29,7 +29,7 @@ public struct PingerSendResult { } /// A type capable of sending and receving ICMP traffic. -public protocol PingerProtocol { +public protocol PingerProtocol: Sendable { var onReply: ((PingerReply) -> Void)? { get set } func openSocket(bindTo interfaceName: String?, destAddress: IPv4Address) throws diff --git a/ios/PacketTunnelCore/Pinger/TunnelPinger.swift b/ios/PacketTunnelCore/Pinger/TunnelPinger.swift index f011fc9a01..b76786eda5 100644 --- a/ios/PacketTunnelCore/Pinger/TunnelPinger.swift +++ b/ios/PacketTunnelCore/Pinger/TunnelPinger.swift @@ -12,7 +12,7 @@ import Network import PacketTunnelCore import WireGuardKit -public final class TunnelPinger: PingerProtocol { +public final class TunnelPinger: PingerProtocol, @unchecked Sendable { private var sequenceNumber: UInt16 = 0 private let stateLock = NSRecursiveLock() private let pingQueue: DispatchQueue diff --git a/ios/PacketTunnelCore/TunnelMonitor/DefaultPathObserverProtocol.swift b/ios/PacketTunnelCore/TunnelMonitor/DefaultPathObserverProtocol.swift index d4d192fb74..96bfb5d7dd 100644 --- a/ios/PacketTunnelCore/TunnelMonitor/DefaultPathObserverProtocol.swift +++ b/ios/PacketTunnelCore/TunnelMonitor/DefaultPathObserverProtocol.swift @@ -23,6 +23,6 @@ public protocol DefaultPathObserverProtocol { } /// A type that represents a network path. -public protocol NetworkPath { +public protocol NetworkPath: Sendable { var status: NetworkExtension.NWPathStatus { get } } diff --git a/ios/PacketTunnelCore/TunnelMonitor/TunnelDeviceInfoProtocol.swift b/ios/PacketTunnelCore/TunnelMonitor/TunnelDeviceInfoProtocol.swift index 829265c607..efd29add7e 100644 --- a/ios/PacketTunnelCore/TunnelMonitor/TunnelDeviceInfoProtocol.swift +++ b/ios/PacketTunnelCore/TunnelMonitor/TunnelDeviceInfoProtocol.swift @@ -9,7 +9,7 @@ import Foundation /// A type that can provide statistics and basic information about tunnel device. -public protocol TunnelDeviceInfoProtocol { +public protocol TunnelDeviceInfoProtocol: Sendable { /// Returns tunnel interface name (i.e utun0) if available. var interfaceName: String? { get } diff --git a/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitor.swift b/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitor.swift index e2b3dbd17b..360c29ee92 100644 --- a/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitor.swift +++ b/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitor.swift @@ -13,7 +13,7 @@ import Network import NetworkExtension /// Tunnel monitor. -public final class TunnelMonitor: TunnelMonitorProtocol { +public final class TunnelMonitor: TunnelMonitorProtocol, @unchecked Sendable { private let tunnelDeviceInfo: TunnelDeviceInfoProtocol private let nslock = NSLock() diff --git a/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitorProtocol.swift b/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitorProtocol.swift index 0a47d01fb7..63677eb9ee 100644 --- a/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitorProtocol.swift +++ b/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitorProtocol.swift @@ -10,7 +10,7 @@ import Foundation import Network /// Tunnel monitor event. -public enum TunnelMonitorEvent { +public enum TunnelMonitorEvent: Sendable { /// Dispatched after receiving the first ping response case connectionEstablished @@ -20,7 +20,7 @@ public enum TunnelMonitorEvent { } /// A type that can provide tunnel monitoring. -public protocol TunnelMonitorProtocol: AnyObject { +public protocol TunnelMonitorProtocol: AnyObject, Sendable { /// Event handler that starts receiving events after the call to `start(probeAddress:)`. var onEvent: ((TunnelMonitorEvent) -> Void)? { get set } diff --git a/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitorTimings.swift b/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitorTimings.swift index 3bb689a473..e2aa2fabb1 100644 --- a/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitorTimings.swift +++ b/ios/PacketTunnelCore/TunnelMonitor/TunnelMonitorTimings.swift @@ -8,7 +8,7 @@ import MullvadTypes -public struct TunnelMonitorTimings { +public struct TunnelMonitorTimings: Sendable { /// Interval for periodic heartbeat ping issued when traffic is flowing. /// Should help to detect connectivity issues on networks that drop traffic in one of directions, /// regardless if tx/rx counters are being updated. |
