From d4b5cd4b0eeb7f80f17a3b72eeb2376092c95c23 Mon Sep 17 00:00:00 2001 From: Bug Magnet Date: Mon, 11 Sep 2023 14:38:59 +0200 Subject: [PATCH] Re enable extensions on NetworkExtension types that were accidentally removed --- .../SimulatorTunnelProvider.swift | 21 ------------------ .../TunnelManager/VPNConnectionProtocol.swift | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/ios/MullvadVPN/SimulatorTunnelProvider/SimulatorTunnelProvider.swift b/ios/MullvadVPN/SimulatorTunnelProvider/SimulatorTunnelProvider.swift index bfbc9cb301b5..52c28faed43a 100644 --- a/ios/MullvadVPN/SimulatorTunnelProvider/SimulatorTunnelProvider.swift +++ b/ios/MullvadVPN/SimulatorTunnelProvider/SimulatorTunnelProvider.swift @@ -11,27 +11,6 @@ import NetworkExtension #if targetEnvironment(simulator) -protocol VPNTunnelProviderManagerProtocol: Equatable { - associatedtype SelfType: VPNTunnelProviderManagerProtocol - associatedtype ConnectionType: VPNConnectionProtocol - - var isEnabled: Bool { get set } - var protocolConfiguration: NEVPNProtocol? { get set } - var localizedDescription: String? { get set } - var connection: ConnectionType { get } - - init() - - func loadFromPreferences(completionHandler: @escaping (Error?) -> Void) - func saveToPreferences(completionHandler: ((Error?) -> Void)?) - func removeFromPreferences(completionHandler: ((Error?) -> Void)?) - - static func loadAllFromPreferences(completionHandler: @escaping ([SelfType]?, Error?) -> Void) -} - -extension NEVPNConnection: VPNConnectionProtocol {} -extension NETunnelProviderSession: VPNTunnelProviderSessionProtocol {} -extension NETunnelProviderManager: VPNTunnelProviderManagerProtocol {} class SimulatorTunnelProviderDelegate { var connection: SimulatorVPNConnection? diff --git a/ios/MullvadVPN/TunnelManager/VPNConnectionProtocol.swift b/ios/MullvadVPN/TunnelManager/VPNConnectionProtocol.swift index fbf9280b9bc0..43f4cfe975c9 100644 --- a/ios/MullvadVPN/TunnelManager/VPNConnectionProtocol.swift +++ b/ios/MullvadVPN/TunnelManager/VPNConnectionProtocol.swift @@ -9,6 +9,24 @@ import Foundation import NetworkExtension +protocol VPNTunnelProviderManagerProtocol: Equatable { + associatedtype SelfType: VPNTunnelProviderManagerProtocol + associatedtype ConnectionType: VPNConnectionProtocol + + var isEnabled: Bool { get set } + var protocolConfiguration: NEVPNProtocol? { get set } + var localizedDescription: String? { get set } + var connection: ConnectionType { get } + + init() + + func loadFromPreferences(completionHandler: @escaping (Error?) -> Void) + func saveToPreferences(completionHandler: ((Error?) -> Void)?) + func removeFromPreferences(completionHandler: ((Error?) -> Void)?) + + static func loadAllFromPreferences(completionHandler: @escaping ([SelfType]?, Error?) -> Void) +} + protocol VPNConnectionProtocol: NSObject { var status: NEVPNStatus { get } var connectedDate: Date? { get } @@ -21,3 +39,7 @@ protocol VPNConnectionProtocol: NSObject { protocol VPNTunnelProviderSessionProtocol { func sendProviderMessage(_ messageData: Data, responseHandler: ((Data?) -> Void)?) throws } + +extension NEVPNConnection: VPNConnectionProtocol {} +extension NETunnelProviderSession: VPNTunnelProviderSessionProtocol {} +extension NETunnelProviderManager: VPNTunnelProviderManagerProtocol {}