From a85404e951f62566bd068e6a7a4643f942b24e50 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Thu, 23 May 2019 21:59:15 +0200 Subject: [PATCH] Rename provider class to OpenVPNTunnelProvider --- .jazzy.yaml | 2 +- TunnelKit.xcodeproj/project.pbxproj | 36 +++++++-------- .../AppExtension/ConnectionStrategy.swift | 6 +-- ...OpenVPNTunnelProvider+Configuration.swift} | 46 +++++++++---------- ...> OpenVPNTunnelProvider+Interaction.swift} | 8 ++-- ...ider.swift => OpenVPNTunnelProvider.swift} | 12 ++--- TunnelKitTests/AppExtensionTests.swift | 8 ++-- 7 files changed, 59 insertions(+), 59 deletions(-) rename TunnelKit/Sources/OpenVPN/AppExtension/{TunnelKitProvider+Configuration.swift => OpenVPNTunnelProvider+Configuration.swift} (93%) rename TunnelKit/Sources/OpenVPN/AppExtension/{TunnelKitProvider+Interaction.swift => OpenVPNTunnelProvider+Interaction.swift} (95%) rename TunnelKit/Sources/OpenVPN/AppExtension/{TunnelKitProvider.swift => OpenVPNTunnelProvider.swift} (98%) diff --git a/.jazzy.yaml b/.jazzy.yaml index d6d4b77..f41fd92 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -33,4 +33,4 @@ custom_categories: - OpenVPNSessionDelegate - name: AppExtension children: - - TunnelKitProvider + - OpenVPNTunnelProvider diff --git a/TunnelKit.xcodeproj/project.pbxproj b/TunnelKit.xcodeproj/project.pbxproj index 1be6bf9..cdbe503 100644 --- a/TunnelKit.xcodeproj/project.pbxproj +++ b/TunnelKit.xcodeproj/project.pbxproj @@ -148,20 +148,20 @@ 0EE2F9F922918DA100F56F49 /* NWUDPSessionState+Description.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E422918DA100F56F49 /* NWUDPSessionState+Description.swift */; }; 0EE2F9FA22918DA100F56F49 /* DNSResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E522918DA100F56F49 /* DNSResolver.swift */; }; 0EE2F9FB22918DA100F56F49 /* DNSResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E522918DA100F56F49 /* DNSResolver.swift */; }; - 0EE2F9FC22918DA100F56F49 /* TunnelKitProvider+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E622918DA100F56F49 /* TunnelKitProvider+Configuration.swift */; }; - 0EE2F9FD22918DA100F56F49 /* TunnelKitProvider+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E622918DA100F56F49 /* TunnelKitProvider+Configuration.swift */; }; + 0EE2F9FC22918DA100F56F49 /* OpenVPNTunnelProvider+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E622918DA100F56F49 /* OpenVPNTunnelProvider+Configuration.swift */; }; + 0EE2F9FD22918DA100F56F49 /* OpenVPNTunnelProvider+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E622918DA100F56F49 /* OpenVPNTunnelProvider+Configuration.swift */; }; 0EE2F9FE22918DA100F56F49 /* Keychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E722918DA100F56F49 /* Keychain.swift */; }; 0EE2F9FF22918DA100F56F49 /* Keychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E722918DA100F56F49 /* Keychain.swift */; }; 0EE2FA0022918DA100F56F49 /* MemoryDestination.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E822918DA100F56F49 /* MemoryDestination.swift */; }; 0EE2FA0122918DA100F56F49 /* MemoryDestination.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E822918DA100F56F49 /* MemoryDestination.swift */; }; 0EE2FA0222918DA100F56F49 /* GenericSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E922918DA100F56F49 /* GenericSocket.swift */; }; 0EE2FA0322918DA100F56F49 /* GenericSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9E922918DA100F56F49 /* GenericSocket.swift */; }; - 0EE2FA0422918DA100F56F49 /* TunnelKitProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9EA22918DA100F56F49 /* TunnelKitProvider.swift */; }; - 0EE2FA0522918DA100F56F49 /* TunnelKitProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9EA22918DA100F56F49 /* TunnelKitProvider.swift */; }; + 0EE2FA0422918DA100F56F49 /* OpenVPNTunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9EA22918DA100F56F49 /* OpenVPNTunnelProvider.swift */; }; + 0EE2FA0522918DA100F56F49 /* OpenVPNTunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9EA22918DA100F56F49 /* OpenVPNTunnelProvider.swift */; }; 0EE2FA0622918DA100F56F49 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9EB22918DA100F56F49 /* Utils.swift */; }; 0EE2FA0722918DA100F56F49 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9EB22918DA100F56F49 /* Utils.swift */; }; - 0EE2FA0822918DA100F56F49 /* TunnelKitProvider+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9EC22918DA100F56F49 /* TunnelKitProvider+Interaction.swift */; }; - 0EE2FA0922918DA100F56F49 /* TunnelKitProvider+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9EC22918DA100F56F49 /* TunnelKitProvider+Interaction.swift */; }; + 0EE2FA0822918DA100F56F49 /* OpenVPNTunnelProvider+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9EC22918DA100F56F49 /* OpenVPNTunnelProvider+Interaction.swift */; }; + 0EE2FA0922918DA100F56F49 /* OpenVPNTunnelProvider+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9EC22918DA100F56F49 /* OpenVPNTunnelProvider+Interaction.swift */; }; 0EE2FA0A22918DA100F56F49 /* InterfaceObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9ED22918DA100F56F49 /* InterfaceObserver.swift */; }; 0EE2FA0B22918DA100F56F49 /* InterfaceObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2F9ED22918DA100F56F49 /* InterfaceObserver.swift */; }; 0EE2FA422291954300F56F49 /* AppExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE2FA0E2291953300F56F49 /* AppExtensionTests.swift */; }; @@ -393,13 +393,13 @@ 0EE2F9E322918DA100F56F49 /* NEUDPSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NEUDPSocket.swift; sourceTree = ""; }; 0EE2F9E422918DA100F56F49 /* NWUDPSessionState+Description.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NWUDPSessionState+Description.swift"; sourceTree = ""; }; 0EE2F9E522918DA100F56F49 /* DNSResolver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DNSResolver.swift; sourceTree = ""; }; - 0EE2F9E622918DA100F56F49 /* TunnelKitProvider+Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TunnelKitProvider+Configuration.swift"; sourceTree = ""; }; + 0EE2F9E622918DA100F56F49 /* OpenVPNTunnelProvider+Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "OpenVPNTunnelProvider+Configuration.swift"; sourceTree = ""; }; 0EE2F9E722918DA100F56F49 /* Keychain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Keychain.swift; sourceTree = ""; }; 0EE2F9E822918DA100F56F49 /* MemoryDestination.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MemoryDestination.swift; sourceTree = ""; }; 0EE2F9E922918DA100F56F49 /* GenericSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GenericSocket.swift; sourceTree = ""; }; - 0EE2F9EA22918DA100F56F49 /* TunnelKitProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TunnelKitProvider.swift; sourceTree = ""; }; + 0EE2F9EA22918DA100F56F49 /* OpenVPNTunnelProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenVPNTunnelProvider.swift; sourceTree = ""; }; 0EE2F9EB22918DA100F56F49 /* Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = ""; }; - 0EE2F9EC22918DA100F56F49 /* TunnelKitProvider+Interaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TunnelKitProvider+Interaction.swift"; sourceTree = ""; }; + 0EE2F9EC22918DA100F56F49 /* OpenVPNTunnelProvider+Interaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "OpenVPNTunnelProvider+Interaction.swift"; sourceTree = ""; }; 0EE2F9ED22918DA100F56F49 /* InterfaceObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InterfaceObserver.swift; sourceTree = ""; }; 0EE2FA0C2291953300F56F49 /* RawPerformanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RawPerformanceTests.swift; sourceTree = ""; }; 0EE2FA0D2291953300F56F49 /* DataPathPerformanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataPathPerformanceTests.swift; sourceTree = ""; }; @@ -617,9 +617,9 @@ 0EE2F9DE22918DA100F56F49 /* ConnectionStrategy.swift */, 0E23B3CF2297192900304C30 /* NETCPLink.swift */, 0E23B3D22297193000304C30 /* NEUDPLink.swift */, - 0EE2F9EA22918DA100F56F49 /* TunnelKitProvider.swift */, - 0EE2F9E622918DA100F56F49 /* TunnelKitProvider+Configuration.swift */, - 0EE2F9EC22918DA100F56F49 /* TunnelKitProvider+Interaction.swift */, + 0EE2F9EA22918DA100F56F49 /* OpenVPNTunnelProvider.swift */, + 0EE2F9E622918DA100F56F49 /* OpenVPNTunnelProvider+Configuration.swift */, + 0EE2F9EC22918DA100F56F49 /* OpenVPNTunnelProvider+Interaction.swift */, ); path = AppExtension; sourceTree = ""; @@ -1328,8 +1328,8 @@ 0E07598020F0060E00F38FD8 /* CryptoAEAD.m in Sources */, 0E011F882196E2AB00BA59EE /* ConfigurationParser.swift in Sources */, 0EE2FA0222918DA100F56F49 /* GenericSocket.swift in Sources */, - 0EE2FA0822918DA100F56F49 /* TunnelKitProvider+Interaction.swift in Sources */, - 0EE2FA0422918DA100F56F49 /* TunnelKitProvider.swift in Sources */, + 0EE2FA0822918DA100F56F49 /* OpenVPNTunnelProvider+Interaction.swift in Sources */, + 0EE2FA0422918DA100F56F49 /* OpenVPNTunnelProvider.swift in Sources */, 0EE2F9FA22918DA100F56F49 /* DNSResolver.swift in Sources */, 0EE2F9F622918DA100F56F49 /* NEUDPSocket.swift in Sources */, 0E39BCEA214B2AB60035E9DE /* ControlPacket.m in Sources */, @@ -1344,7 +1344,7 @@ 0E411B9D2271F90700E0852C /* DNS.m in Sources */, 0EFEB45B2006D3C800F81029 /* TLSBox.m in Sources */, 0E58BF3922405410006FB157 /* minilzo.c in Sources */, - 0EE2F9FC22918DA100F56F49 /* TunnelKitProvider+Configuration.swift in Sources */, + 0EE2F9FC22918DA100F56F49 /* OpenVPNTunnelProvider+Configuration.swift in Sources */, 0EFEB4702006D3C800F81029 /* Allocation.m in Sources */, 0E041D092152E6FE0025FE3C /* TLSWrap.swift in Sources */, 0EFEB4672006D3C800F81029 /* OpenVPNSession.swift in Sources */, @@ -1410,8 +1410,8 @@ 0EFEB4932006D7F300F81029 /* CryptoBox.m in Sources */, 0E011F892196E2AB00BA59EE /* ConfigurationParser.swift in Sources */, 0EE2FA0322918DA100F56F49 /* GenericSocket.swift in Sources */, - 0EE2FA0922918DA100F56F49 /* TunnelKitProvider+Interaction.swift in Sources */, - 0EE2FA0522918DA100F56F49 /* TunnelKitProvider.swift in Sources */, + 0EE2FA0922918DA100F56F49 /* OpenVPNTunnelProvider+Interaction.swift in Sources */, + 0EE2FA0522918DA100F56F49 /* OpenVPNTunnelProvider.swift in Sources */, 0EE2F9FB22918DA100F56F49 /* DNSResolver.swift in Sources */, 0EE2F9F722918DA100F56F49 /* NEUDPSocket.swift in Sources */, 0E39BCEB214B2AB60035E9DE /* ControlPacket.m in Sources */, @@ -1426,7 +1426,7 @@ 0E411B9E2271F90700E0852C /* DNS.m in Sources */, 0EFEB4902006D7F300F81029 /* TunnelInterface.swift in Sources */, 0EFEB49E2006D7F300F81029 /* Allocation.m in Sources */, - 0EE2F9FD22918DA100F56F49 /* TunnelKitProvider+Configuration.swift in Sources */, + 0EE2F9FD22918DA100F56F49 /* OpenVPNTunnelProvider+Configuration.swift in Sources */, 0E58BF3A22405410006FB157 /* minilzo.c in Sources */, 0E041D0A2152E6FE0025FE3C /* TLSWrap.swift in Sources */, 0EFEB48E2006D7F300F81029 /* SessionKey.swift in Sources */, diff --git a/TunnelKit/Sources/OpenVPN/AppExtension/ConnectionStrategy.swift b/TunnelKit/Sources/OpenVPN/AppExtension/ConnectionStrategy.swift index 790e4e1..7992126 100644 --- a/TunnelKit/Sources/OpenVPN/AppExtension/ConnectionStrategy.swift +++ b/TunnelKit/Sources/OpenVPN/AppExtension/ConnectionStrategy.swift @@ -51,7 +51,7 @@ class ConnectionStrategy { private var currentProtocolIndex = 0 - init(configuration: TunnelKitProvider.Configuration) { + init(configuration: OpenVPNTunnelProvider.Configuration) { hostname = configuration.sessionConfiguration.hostname prefersResolvedAddresses = (hostname == nil) || configuration.prefersResolvedAddresses resolvedAddresses = configuration.resolvedAddresses @@ -95,7 +95,7 @@ class ConnectionStrategy { // fall back to DNS guard let hostname = hostname else { log.error("DNS resolution unavailable: no hostname provided!") - completionHandler(nil, TunnelKitProvider.ProviderError.dnsFailure) + completionHandler(nil, OpenVPNTunnelProvider.ProviderError.dnsFailure) return } log.debug("DNS resolve hostname: \(hostname.maskedDescription)") @@ -112,7 +112,7 @@ class ConnectionStrategy { guard let targetAddress = self.resolvedAddress(from: addresses) else { log.error("No resolved or fallback address available") - completionHandler(nil, TunnelKitProvider.ProviderError.dnsFailure) + completionHandler(nil, OpenVPNTunnelProvider.ProviderError.dnsFailure) return } diff --git a/TunnelKit/Sources/OpenVPN/AppExtension/TunnelKitProvider+Configuration.swift b/TunnelKit/Sources/OpenVPN/AppExtension/OpenVPNTunnelProvider+Configuration.swift similarity index 93% rename from TunnelKit/Sources/OpenVPN/AppExtension/TunnelKitProvider+Configuration.swift rename to TunnelKit/Sources/OpenVPN/AppExtension/OpenVPNTunnelProvider+Configuration.swift index 86f0b1f..7278879 100644 --- a/TunnelKit/Sources/OpenVPN/AppExtension/TunnelKitProvider+Configuration.swift +++ b/TunnelKit/Sources/OpenVPN/AppExtension/OpenVPNTunnelProvider+Configuration.swift @@ -1,5 +1,5 @@ // -// TunnelKitProvider+Configuration.swift +// OpenVPNTunnelProvider+Configuration.swift // TunnelKit // // Created by Davide De Rosa on 10/23/17. @@ -40,11 +40,11 @@ import SwiftyBeaver private let log = SwiftyBeaver.self -extension TunnelKitProvider { +extension OpenVPNTunnelProvider { // MARK: Configuration - /// The way to create a `TunnelKitProvider.Configuration` object for the tunnel profile. + /// The way to create a `OpenVPNTunnelProvider.Configuration` object for the tunnel profile. public struct ConfigurationBuilder { /// :nodoc: @@ -198,9 +198,9 @@ extension TunnelKitProvider { } /** - Builds a `TunnelKitProvider.Configuration` object that will connect to the provided endpoint. + Builds a `OpenVPNTunnelProvider.Configuration` object that will connect to the provided endpoint. - - Returns: A `TunnelKitProvider.Configuration` object with this builder and the additional method parameters. + - Returns: A `OpenVPNTunnelProvider.Configuration` object with this builder and the additional method parameters. */ public func build() -> Configuration { return Configuration( @@ -216,7 +216,7 @@ extension TunnelKitProvider { } } - /// Offers a bridge between the abstract `TunnelKitProvider.ConfigurationBuilder` and a concrete `NETunnelProviderProtocol` profile. + /// Offers a bridge between the abstract `OpenVPNTunnelProvider.ConfigurationBuilder` and a concrete `NETunnelProviderProtocol` profile. public struct Configuration: Codable { struct Keys { static let appGroup = "AppGroup" @@ -280,29 +280,29 @@ extension TunnelKitProvider { static let masksPrivateData = "MasksPrivateData" } - /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.prefersResolvedAddresses` + /// - Seealso: `OpenVPNTunnelProvider.ConfigurationBuilder.prefersResolvedAddresses` public let prefersResolvedAddresses: Bool - /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.resolvedAddresses` + /// - Seealso: `OpenVPNTunnelProvider.ConfigurationBuilder.resolvedAddresses` public let resolvedAddresses: [String]? /// - Seealso: `OpenVPN.Configuration.endpointProtocols` @available(*, deprecated) public var endpointProtocols: [EndpointProtocol]? - /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.mtu` + /// - Seealso: `OpenVPNTunnelProvider.ConfigurationBuilder.mtu` public let mtu: Int - /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.sessionConfiguration` + /// - Seealso: `OpenVPNTunnelProvider.ConfigurationBuilder.sessionConfiguration` public let sessionConfiguration: OpenVPN.Configuration - /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.shouldDebug` + /// - Seealso: `OpenVPNTunnelProvider.ConfigurationBuilder.shouldDebug` public let shouldDebug: Bool - /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.debugLogFormat` + /// - Seealso: `OpenVPNTunnelProvider.ConfigurationBuilder.debugLogFormat` public let debugLogFormat: String? - /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.masksPrivateData` + /// - Seealso: `OpenVPNTunnelProvider.ConfigurationBuilder.masksPrivateData` public let masksPrivateData: Bool? // MARK: Shortcuts @@ -397,10 +397,10 @@ extension TunnelKitProvider { } /** - Parses a new `TunnelKitProvider.Configuration` object from a provider configuration map. + Parses a new `OpenVPNTunnelProvider.Configuration` object from a provider configuration map. - Parameter from: The map to parse. - - Returns: The parsed `TunnelKitProvider.Configuration` object. + - Returns: The parsed `OpenVPNTunnelProvider.Configuration` object. - Throws: `ProviderError.configuration` if `providerConfiguration` is incomplete. */ public static func parsed(from providerConfiguration: [String: Any]) throws -> Configuration { @@ -613,15 +613,15 @@ extension TunnelKitProvider { // MARK: Modification -extension TunnelKitProvider.Configuration { +extension OpenVPNTunnelProvider.Configuration { /** - Returns a `TunnelKitProvider.ConfigurationBuilder` to use this configuration as a starting point for a new one. + Returns a `OpenVPNTunnelProvider.ConfigurationBuilder` to use this configuration as a starting point for a new one. - - Returns: An editable `TunnelKitProvider.ConfigurationBuilder` initialized with this configuration. + - Returns: An editable `OpenVPNTunnelProvider.ConfigurationBuilder` initialized with this configuration. */ - public func builder() -> TunnelKitProvider.ConfigurationBuilder { - var builder = TunnelKitProvider.ConfigurationBuilder(sessionConfiguration: sessionConfiguration) + public func builder() -> OpenVPNTunnelProvider.ConfigurationBuilder { + var builder = OpenVPNTunnelProvider.ConfigurationBuilder(sessionConfiguration: sessionConfiguration) builder.prefersResolvedAddresses = prefersResolvedAddresses builder.resolvedAddresses = resolvedAddresses builder.mtu = mtu @@ -636,14 +636,14 @@ extension TunnelKitProvider.Configuration { public extension UserDefaults { @objc var dataCountArray: [Int]? { get { - return array(forKey: TunnelKitProvider.Configuration.dataCountKey) as? [Int] + return array(forKey: OpenVPNTunnelProvider.Configuration.dataCountKey) as? [Int] } set { - set(newValue, forKey: TunnelKitProvider.Configuration.dataCountKey) + set(newValue, forKey: OpenVPNTunnelProvider.Configuration.dataCountKey) } } func removeDataCountArray() { - removeObject(forKey: TunnelKitProvider.Configuration.dataCountKey) + removeObject(forKey: OpenVPNTunnelProvider.Configuration.dataCountKey) } } diff --git a/TunnelKit/Sources/OpenVPN/AppExtension/TunnelKitProvider+Interaction.swift b/TunnelKit/Sources/OpenVPN/AppExtension/OpenVPNTunnelProvider+Interaction.swift similarity index 95% rename from TunnelKit/Sources/OpenVPN/AppExtension/TunnelKitProvider+Interaction.swift rename to TunnelKit/Sources/OpenVPN/AppExtension/OpenVPNTunnelProvider+Interaction.swift index a3cdba0..6c6e36e 100644 --- a/TunnelKit/Sources/OpenVPN/AppExtension/TunnelKitProvider+Interaction.swift +++ b/TunnelKit/Sources/OpenVPN/AppExtension/OpenVPNTunnelProvider+Interaction.swift @@ -1,5 +1,5 @@ // -// TunnelKitProvider+Interaction.swift +// OpenVPNTunnelProvider+Interaction.swift // TunnelKit // // Created by Davide De Rosa on 9/24/17. @@ -36,11 +36,11 @@ import Foundation -extension TunnelKitProvider { +extension OpenVPNTunnelProvider { // MARK: Interaction - /// The messages accepted by `TunnelKitProvider`. + /// The messages accepted by `OpenVPNTunnelProvider`. public class Message: Equatable { /// Requests a snapshot of the latest debug log. Returns the log data decoded from UTF-8. @@ -73,7 +73,7 @@ extension TunnelKitProvider { // mostly programming errors by host app enum ProviderConfigurationError: Error { - /// A field in the `TunnelKitProvider.Configuration` provided is incorrect or incomplete. + /// A field in the `OpenVPNTunnelProvider.Configuration` provided is incorrect or incomplete. case parameter(name: String) /// Credentials are missing or inaccessible. diff --git a/TunnelKit/Sources/OpenVPN/AppExtension/TunnelKitProvider.swift b/TunnelKit/Sources/OpenVPN/AppExtension/OpenVPNTunnelProvider.swift similarity index 98% rename from TunnelKit/Sources/OpenVPN/AppExtension/TunnelKitProvider.swift rename to TunnelKit/Sources/OpenVPN/AppExtension/OpenVPNTunnelProvider.swift index 23943c2..a1c20fe 100644 --- a/TunnelKit/Sources/OpenVPN/AppExtension/TunnelKitProvider.swift +++ b/TunnelKit/Sources/OpenVPN/AppExtension/OpenVPNTunnelProvider.swift @@ -1,5 +1,5 @@ // -// TunnelKitProvider.swift +// OpenVPNTunnelProvider.swift // TunnelKit // // Created by Davide De Rosa on 2/1/17. @@ -44,7 +44,7 @@ private let log = SwiftyBeaver.self Provides an all-in-one `NEPacketTunnelProvider` implementation for use in a Packet Tunnel Provider extension both on iOS and macOS. */ -open class TunnelKitProvider: NEPacketTunnelProvider { +open class OpenVPNTunnelProvider: NEPacketTunnelProvider { // MARK: Tweaks @@ -89,7 +89,7 @@ open class TunnelKitProvider: NEPacketTunnelProvider { private let observer = InterfaceObserver() - private let tunnelQueue = DispatchQueue(label: TunnelKitProvider.description()) + private let tunnelQueue = DispatchQueue(label: OpenVPNTunnelProvider.description()) private let prngSeedLength = 64 @@ -382,7 +382,7 @@ open class TunnelKitProvider: NEPacketTunnelProvider { } } -extension TunnelKitProvider: GenericSocketDelegate { +extension OpenVPNTunnelProvider: GenericSocketDelegate { // MARK: GenericSocketDelegate (tunnel queue) @@ -470,7 +470,7 @@ extension TunnelKitProvider: GenericSocketDelegate { } } -extension TunnelKitProvider: OpenVPNSessionDelegate { +extension OpenVPNTunnelProvider: OpenVPNSessionDelegate { // MARK: OpenVPNSessionDelegate (tunnel queue) @@ -721,7 +721,7 @@ extension TunnelKitProvider: OpenVPNSessionDelegate { } } -extension TunnelKitProvider { +extension OpenVPNTunnelProvider { private func tryNextProtocol() -> Bool { guard strategy.tryNextProtocol() else { disposeTunnel(error: ProviderError.exhaustedProtocols) diff --git a/TunnelKitTests/AppExtensionTests.swift b/TunnelKitTests/AppExtensionTests.swift index 3e95861..2efb374 100644 --- a/TunnelKitTests/AppExtensionTests.swift +++ b/TunnelKitTests/AppExtensionTests.swift @@ -51,8 +51,8 @@ class AppExtensionTests: XCTestCase { } func testConfiguration() { - var builder: TunnelKitProvider.ConfigurationBuilder! - var cfg: TunnelKitProvider.Configuration! + var builder: OpenVPNTunnelProvider.ConfigurationBuilder! + var cfg: OpenVPNTunnelProvider.Configuration! let identifier = "com.example.Provider" let appGroup = "group.com.algoritmico.TunnelKit" @@ -65,7 +65,7 @@ class AppExtensionTests: XCTestCase { sessionBuilder.digest = .sha256 sessionBuilder.hostname = hostname sessionBuilder.endpointProtocols = [] - builder = TunnelKitProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build()) + builder = OpenVPNTunnelProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build()) XCTAssertNotNil(builder) cfg = builder.build() @@ -82,7 +82,7 @@ class AppExtensionTests: XCTestCase { print("\(pc)") } - let K = TunnelKitProvider.Configuration.Keys.self + let K = OpenVPNTunnelProvider.Configuration.Keys.self XCTAssertEqual(proto?.providerConfiguration?[K.appGroup] as? String, appGroup) XCTAssertEqual(proto?.providerConfiguration?[K.cipherAlgorithm] as? String, cfg.sessionConfiguration.cipher?.rawValue) XCTAssertEqual(proto?.providerConfiguration?[K.digestAlgorithm] as? String, cfg.sessionConfiguration.digest?.rawValue)