Rename provider class to OpenVPNTunnelProvider
This commit is contained in:
parent
9445b825d0
commit
a85404e951
|
@ -33,4 +33,4 @@ custom_categories:
|
|||
- OpenVPNSessionDelegate
|
||||
- name: AppExtension
|
||||
children:
|
||||
- TunnelKitProvider
|
||||
- OpenVPNTunnelProvider
|
||||
|
|
|
@ -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 = "<group>"; };
|
||||
0EE2F9E422918DA100F56F49 /* NWUDPSessionState+Description.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NWUDPSessionState+Description.swift"; sourceTree = "<group>"; };
|
||||
0EE2F9E522918DA100F56F49 /* DNSResolver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DNSResolver.swift; sourceTree = "<group>"; };
|
||||
0EE2F9E622918DA100F56F49 /* TunnelKitProvider+Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TunnelKitProvider+Configuration.swift"; sourceTree = "<group>"; };
|
||||
0EE2F9E622918DA100F56F49 /* OpenVPNTunnelProvider+Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "OpenVPNTunnelProvider+Configuration.swift"; sourceTree = "<group>"; };
|
||||
0EE2F9E722918DA100F56F49 /* Keychain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Keychain.swift; sourceTree = "<group>"; };
|
||||
0EE2F9E822918DA100F56F49 /* MemoryDestination.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MemoryDestination.swift; sourceTree = "<group>"; };
|
||||
0EE2F9E922918DA100F56F49 /* GenericSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GenericSocket.swift; sourceTree = "<group>"; };
|
||||
0EE2F9EA22918DA100F56F49 /* TunnelKitProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TunnelKitProvider.swift; sourceTree = "<group>"; };
|
||||
0EE2F9EA22918DA100F56F49 /* OpenVPNTunnelProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenVPNTunnelProvider.swift; sourceTree = "<group>"; };
|
||||
0EE2F9EB22918DA100F56F49 /* Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
|
||||
0EE2F9EC22918DA100F56F49 /* TunnelKitProvider+Interaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TunnelKitProvider+Interaction.swift"; sourceTree = "<group>"; };
|
||||
0EE2F9EC22918DA100F56F49 /* OpenVPNTunnelProvider+Interaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "OpenVPNTunnelProvider+Interaction.swift"; sourceTree = "<group>"; };
|
||||
0EE2F9ED22918DA100F56F49 /* InterfaceObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InterfaceObserver.swift; sourceTree = "<group>"; };
|
||||
0EE2FA0C2291953300F56F49 /* RawPerformanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RawPerformanceTests.swift; sourceTree = "<group>"; };
|
||||
0EE2FA0D2291953300F56F49 /* DataPathPerformanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataPathPerformanceTests.swift; sourceTree = "<group>"; };
|
||||
|
@ -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 = "<group>";
|
||||
|
@ -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 */,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
|
@ -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.
|
|
@ -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)
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue