Skip to content

Commit

Permalink
Re enable extensions on NetworkExtension types that were accidentally…
Browse files Browse the repository at this point in the history
… removed
  • Loading branch information
buggmagnet committed Sep 11, 2023
1 parent 4d28de5 commit d4b5cd4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
22 changes: 22 additions & 0 deletions ios/MullvadVPN/TunnelManager/VPNConnectionProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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 {}

0 comments on commit d4b5cd4

Please sign in to comment.