Upgrade to TunnelKit 2.0

Major reorganization. No changes in logic.

Rename by_* to pod_*.
This commit is contained in:
Davide De Rosa 2019-05-23 23:13:45 +02:00
parent 5b2ec85ee1
commit 87527ed290
24 changed files with 104 additions and 104 deletions

View File

@ -25,7 +25,7 @@
import TunnelKit
class PacketTunnelProvider: TunnelKitProvider {
class PacketTunnelProvider: OpenVPNTunnelProvider {
override func startTunnel(options: [String : NSObject]?, completionHandler: @escaping (Error?) -> Void) {
appVersion = "\(GroupConstants.App.name) \(GroupConstants.App.versionString)"
dnsTimeout = GroupConstants.VPN.dnsTimeout

View File

@ -106,11 +106,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
let passphraseCancelBlock = {
_ = try? FileManager.default.removeItem(at: url)
}
guard let parsingResult = ConfigurationParser.Result.from(url, withErrorAlertIn: target, passphrase: passphrase, passphraseBlock: passphraseBlock, passphraseCancelBlock: passphraseCancelBlock) else {
guard let parsingResult = OpenVPN.ConfigurationParser.Result.from(url, withErrorAlertIn: target, passphrase: passphrase, passphraseBlock: passphraseBlock, passphraseCancelBlock: passphraseCancelBlock) else {
return true
}
if let warning = parsingResult.warning {
ConfigurationParser.Result.alertImportWarning(url: url, in: target, withWarning: warning) {
OpenVPN.ConfigurationParser.Result.alertImportWarning(url: url, in: target, withWarning: warning) {
if $0 {
self.handleParsingResult(parsingResult, in: target)
} else {
@ -123,7 +123,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
return true
}
private func handleParsingResult(_ parsingResult: ConfigurationParser.Result, in target: UIViewController) {
private func handleParsingResult(_ parsingResult: OpenVPN.ConfigurationParser.Result, in target: UIViewController) {
// already presented: update parsed configuration
if let nav = target as? UINavigationController, let wizard = nav.topViewController as? WizardHostViewController {

View File

@ -1,5 +1,5 @@
//
// ConfigurationParserResult+Alerts.swift
// OpenVPN.ConfigurationParserResult+Alerts.swift
// Passepartout-iOS
//
// Created by Davide De Rosa on 10/27/18.
@ -31,16 +31,16 @@ import Passepartout_Core
private let log = SwiftyBeaver.self
extension ConfigurationParser.Result {
extension OpenVPN.ConfigurationParser.Result {
static func from(_ url: URL, withErrorAlertIn viewController: UIViewController, passphrase: String?,
passphraseBlock: @escaping (String) -> Void, passphraseCancelBlock: (() -> Void)?) -> ConfigurationParser.Result? {
passphraseBlock: @escaping (String) -> Void, passphraseCancelBlock: (() -> Void)?) -> OpenVPN.ConfigurationParser.Result? {
let result: ConfigurationParser.Result
let result: OpenVPN.ConfigurationParser.Result
let fm = FileManager.default
log.debug("Parsing configuration URL: \(url)")
do {
result = try ConfigurationParser.parsed(fromURL: url, passphrase: passphrase)
result = try OpenVPN.ConfigurationParser.parsed(fromURL: url, passphrase: passphrase)
} catch let e as ConfigurationError {
switch e {
case .encryptionPassphrase, .unableToDecrypt(_):

View File

@ -92,7 +92,7 @@ class IssueReporter: NSObject {
}
if let url = configurationURL {
do {
let parsedFile = try ConfigurationParser.parsed(fromURL: url, returnsStripped: true)
let parsedFile = try OpenVPN.ConfigurationParser.parsed(fromURL: url, returnsStripped: true)
if let attachment = parsedFile.strippedLines?.joined(separator: "\n").data(using: .utf8) {
vc.addAttachmentData(attachment, mimeType: AppConstants.IssueReporter.MIME.configuration, fileName: AppConstants.IssueReporter.Filenames.configuration)
}

View File

@ -75,7 +75,7 @@ extension SettingTableViewCell {
accessoryType = .none
}
func applyVPN(_ theme: Theme, with vpnStatus: VPNStatus?, error: TunnelKitProvider.ProviderError?) {
func applyVPN(_ theme: Theme, with vpnStatus: VPNStatus?, error: OpenVPNTunnelProvider.ProviderError?) {
leftTextColor = theme.palette.primaryText
guard let vpnStatus = vpnStatus else {
rightText = L10n.Vpn.disabled

View File

@ -27,7 +27,7 @@ import Foundation
import TunnelKit
protocol ConfigurationModificationDelegate: class {
func configuration(didUpdate newConfiguration: SessionProxy.Configuration)
func configuration(didUpdate newConfiguration: OpenVPN.Configuration)
func configurationShouldReinstall()
}

View File

@ -35,9 +35,9 @@ class ConfigurationViewController: UIViewController, TableModelHost {
private lazy var itemRefresh = UIBarButtonItem(barButtonSystemItem: .refresh, target: self, action: #selector(refresh))
var initialConfiguration: SessionProxy.Configuration!
var initialConfiguration: OpenVPN.Configuration!
private lazy var configuration: SessionProxy.ConfigurationBuilder = initialConfiguration.builder()
private lazy var configuration: OpenVPN.ConfigurationBuilder = initialConfiguration.builder()
var originalConfigurationURL: URL?
@ -138,9 +138,9 @@ class ConfigurationViewController: UIViewController, TableModelHost {
log.warning("Resetting with no original configuration set? Bad table model?")
return
}
let parsingResult: ConfigurationParser.Result
let parsingResult: OpenVPN.ConfigurationParser.Result
do {
parsingResult = try ConfigurationParser.parsed(fromURL: originalURL)
parsingResult = try OpenVPN.ConfigurationParser.parsed(fromURL: originalURL)
} catch let e {
log.error("Could not parse original configuration: \(e)")
return
@ -373,7 +373,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
switch model.row(at: indexPath) {
case .cipher:
let vc = OptionViewController<SessionProxy.Cipher>()
let vc = OptionViewController<OpenVPN.Cipher>()
vc.title = settingCell?.leftText
vc.options = [.aes128cbc, .aes192cbc, .aes256cbc, .aes128gcm, .aes192gcm, .aes256gcm]
vc.selectedOption = configuration.cipher
@ -385,7 +385,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
navigationController?.pushViewController(vc, animated: true)
case .digest:
let vc = OptionViewController<SessionProxy.Digest>()
let vc = OptionViewController<OpenVPN.Digest>()
vc.title = settingCell?.leftText
vc.options = [.sha1, .sha224, .sha256, .sha384, .sha512]
vc.selectedOption = configuration.digest
@ -397,7 +397,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
navigationController?.pushViewController(vc, animated: true)
case .compressionFraming:
let vc = OptionViewController<SessionProxy.CompressionFraming>()
let vc = OptionViewController<OpenVPN.CompressionFraming>()
vc.title = settingCell?.leftText
vc.options = [.disabled, .compLZO, .compress]
vc.selectedOption = configuration.compressionFraming ?? .disabled
@ -416,7 +416,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
return
}
let vc = OptionViewController<SessionProxy.CompressionAlgorithm>()
let vc = OptionViewController<OpenVPN.CompressionAlgorithm>()
vc.title = settingCell?.leftText
vc.options = [.disabled, .LZO]
vc.selectedOption = configuration.compressionAlgorithm ?? .disabled
@ -449,7 +449,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
// MARK: -
private extension SessionProxy.CompressionFraming {
private extension OpenVPN.CompressionFraming {
var cellDescription: String {
let V = L10n.Configuration.Cells.self
switch self {
@ -465,7 +465,7 @@ private extension SessionProxy.CompressionFraming {
}
}
private extension SessionProxy.CompressionAlgorithm {
private extension OpenVPN.CompressionAlgorithm {
var cellDescription: String {
let V = L10n.Configuration.Cells.self
switch self {

View File

@ -33,7 +33,7 @@ private let log = SwiftyBeaver.self
class ImportedHostsViewController: UITableViewController {
private lazy var pendingConfigurationURLs = TransientStore.shared.service.pendingConfigurationURLs().sortedCaseInsensitive()
private var parsingResult: ConfigurationParser.Result?
private var parsingResult: OpenVPN.ConfigurationParser.Result?
override func viewDidLoad() {
super.viewDidLoad()
@ -88,7 +88,7 @@ class ImportedHostsViewController: UITableViewController {
}
self.perform(segue: StoryboardSegue.Organizer.importHostSegueIdentifier, sender: cell)
}
guard let parsingResult = ConfigurationParser.Result.from(url, withErrorAlertIn: self, passphrase: passphrase, passphraseBlock: passphraseBlock, passphraseCancelBlock: nil) else {
guard let parsingResult = OpenVPN.ConfigurationParser.Result.from(url, withErrorAlertIn: self, passphrase: passphrase, passphraseBlock: passphraseBlock, passphraseCancelBlock: nil) else {
deselectSelectedRow()
return false
}
@ -96,7 +96,7 @@ class ImportedHostsViewController: UITableViewController {
// postpone segue until alert dismissal
if let warning = parsingResult.warning {
ConfigurationParser.Result.alertImportWarning(url: url, in: self, withWarning: warning) {
OpenVPN.ConfigurationParser.Result.alertImportWarning(url: url, in: self, withWarning: warning) {
self.deselectSelectedRow()
if $0 {
self.perform(segue: StoryboardSegue.Organizer.importHostSegueIdentifier)

View File

@ -37,7 +37,7 @@ class WizardHostViewController: UITableViewController, TableModelHost {
return TransientStore.shared.service.ids(forContext: .host).sortedCaseInsensitive()
}()
var parsingResult: ConfigurationParser.Result? {
var parsingResult: OpenVPN.ConfigurationParser.Result? {
didSet {
useSuggestedTitle()
}
@ -104,7 +104,7 @@ class WizardHostViewController: UITableViewController, TableModelHost {
}
let profile = HostConnectionProfile(title: enteredTitle, hostname: hostname)
let builder = TunnelKitProvider.ConfigurationBuilder(sessionConfiguration: result.configuration)
let builder = OpenVPNTunnelProvider.ConfigurationBuilder(sessionConfiguration: result.configuration)
profile.parameters = builder.build()
let service = TransientStore.shared.service

View File

@ -1217,7 +1217,7 @@ extension ServiceViewController: TrustedNetworksModelDelegate {
// MARK: -
extension ServiceViewController: ConfigurationModificationDelegate {
func configuration(didUpdate newConfiguration: SessionProxy.Configuration) {
func configuration(didUpdate newConfiguration: OpenVPN.Configuration) {
if let hostProfile = profile as? HostConnectionProfile {
var builder = hostProfile.parameters.builder()
builder.sessionConfiguration = newConfiguration

View File

@ -46,7 +46,7 @@ public protocol ConnectionProfile: class, EndpointDataSource, CustomStringConver
var manualNetworkSettings: ProfileNetworkSettings? { get set }
func generate(from configuration: TunnelKitProvider.Configuration, preferences: Preferences) throws -> TunnelKitProvider.Configuration
func generate(from configuration: OpenVPNTunnelProvider.Configuration, preferences: Preferences) throws -> OpenVPNTunnelProvider.Configuration
func with(newId: String) -> ConnectionProfile
}

View File

@ -89,7 +89,7 @@ public class ConnectionService: Codable {
private let keychain: Keychain
public var baseConfiguration: TunnelKitProvider.Configuration
public var baseConfiguration: OpenVPNTunnelProvider.Configuration
private var cache: [ProfileKey: ConnectionProfile]
@ -124,7 +124,7 @@ public class ConnectionService: Codable {
public weak var delegate: ConnectionServiceDelegate?
public init(withAppGroup appGroup: String, baseConfiguration: TunnelKitProvider.Configuration) {
public init(withAppGroup appGroup: String, baseConfiguration: OpenVPNTunnelProvider.Configuration) {
guard let defaults = UserDefaults(suiteName: appGroup) else {
fatalError("No entitlements for group '\(appGroup)'")
}
@ -157,7 +157,7 @@ public class ConnectionService: Codable {
self.defaults = defaults
keychain = Keychain(group: appGroup)
baseConfiguration = try container.decode(TunnelKitProvider.Configuration.self, forKey: .baseConfiguration)
baseConfiguration = try container.decode(OpenVPNTunnelProvider.Configuration.self, forKey: .baseConfiguration)
activeProfileKey = try container.decodeIfPresent(ProfileKey.self, forKey: .activeProfileKey)
preferences = try container.decode(EditablePreferences.self, forKey: .preferences)
@ -281,20 +281,10 @@ public class ConnectionService: Codable {
profile = providerProfile
case .host:
let hostProfile = try decoder.decode(HostConnectionProfile.self, from: data)
// XXX: migrate old endpointProtocols
if hostProfile.parameters.sessionConfiguration.endpointProtocols == nil {
var sessionBuilder = hostProfile.parameters.sessionConfiguration.builder()
sessionBuilder.endpointProtocols = hostProfile.parameters.endpointProtocols
var parametersBuilder = hostProfile.parameters.builder()
parametersBuilder.sessionConfiguration = sessionBuilder.build()
hostProfile.parameters = parametersBuilder.build()
}
// XXX: re-read routing policies for
profile = hostProfile
// let hostProfile = try decoder.decode(HostConnectionProfile.self, from: data)
//
// profile = hostProfile
break
}
cache[key] = profile
} catch let e {
@ -350,8 +340,8 @@ public class ConnectionService: Codable {
}
// can fail due to passphrase (migration is non-interactive)
if let result = try? ConfigurationParser.parsed(fromURL: url) {
host.parameters = TunnelKitProvider.ConfigurationBuilder(sessionConfiguration: result.configuration).build()
if let result = try? OpenVPN.ConfigurationParser.parsed(fromURL: url) {
host.parameters = OpenVPNTunnelProvider.ConfigurationBuilder(sessionConfiguration: result.configuration).build()
} else {
// fall back to the safer option
@ -602,7 +592,7 @@ public class ConnectionService: Codable {
try? FileManager.default.removeItem(at: url)
}
public var vpnLastError: TunnelKitProvider.ProviderError? {
public var vpnLastError: OpenVPNTunnelProvider.ProviderError? {
return baseConfiguration.lastError(in: appGroup)
}

View File

@ -26,7 +26,7 @@
import Foundation
import TunnelKit
public typealias Credentials = SessionProxy.Credentials
public typealias Credentials = OpenVPN.Credentials
public extension Credentials {
var isEmpty: Bool {

View File

@ -49,7 +49,7 @@ public class ProfileNetworkChoices: Codable {
}
public class ProfileNetworkSettings: Codable, CustomStringConvertible {
public var gatewayPolicies: [SessionProxy.RoutingPolicy]?
public var gatewayPolicies: [OpenVPN.RoutingPolicy]?
public var dnsServers: [String]?
@ -72,7 +72,7 @@ public class ProfileNetworkSettings: Codable, CustomStringConvertible {
gatewayPolicies = [.IPv4, .IPv6]
}
public init(from configuration: SessionProxy.Configuration) {
public init(from configuration: OpenVPN.Configuration) {
gatewayPolicies = configuration.routingPolicies
dnsDomainName = configuration.searchDomain
dnsServers = configuration.dnsServers
@ -114,7 +114,7 @@ public class ProfileNetworkSettings: Codable, CustomStringConvertible {
}
}
extension SessionProxy.ConfigurationBuilder {
extension OpenVPN.ConfigurationBuilder {
public mutating func applyGateway(from choices: ProfileNetworkChoices, settings: ProfileNetworkSettings) {
switch choices.gateway {
case .client:

View File

@ -31,13 +31,13 @@ public class HostConnectionProfile: ConnectionProfile, Codable, Equatable {
public let hostname: String
public var parameters: TunnelKitProvider.Configuration
public var parameters: OpenVPNTunnelProvider.Configuration
public init(title: String, hostname: String) {
self.title = title
self.hostname = hostname
let sessionConfiguration = SessionProxy.ConfigurationBuilder().build()
parameters = TunnelKitProvider.ConfigurationBuilder(sessionConfiguration: sessionConfiguration).build()
let sessionConfiguration = OpenVPN.ConfigurationBuilder().build()
parameters = OpenVPNTunnelProvider.ConfigurationBuilder(sessionConfiguration: sessionConfiguration).build()
}
// MARK: ConnectionProfile
@ -58,7 +58,7 @@ public class HostConnectionProfile: ConnectionProfile, Codable, Equatable {
public var manualNetworkSettings: ProfileNetworkSettings?
public func generate(from configuration: TunnelKitProvider.Configuration, preferences: Preferences) throws -> TunnelKitProvider.Configuration {
public func generate(from configuration: OpenVPNTunnelProvider.Configuration, preferences: Preferences) throws -> OpenVPNTunnelProvider.Configuration {
guard let endpointProtocols = parameters.sessionConfiguration.endpointProtocols, !endpointProtocols.isEmpty else {
preconditionFailure("No endpointProtocols")
}

View File

@ -39,7 +39,7 @@ public class PlaceholderConnectionProfile: ConnectionProfile {
public var manualNetworkSettings: ProfileNetworkSettings?
public func generate(from configuration: TunnelKitProvider.Configuration, preferences: Preferences) throws -> TunnelKitProvider.Configuration {
public func generate(from configuration: OpenVPNTunnelProvider.Configuration, preferences: Preferences) throws -> OpenVPNTunnelProvider.Configuration {
fatalError("Generating configuration from a PlaceholderConnectionProfile")
}

View File

@ -114,7 +114,7 @@ public class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
return true
}
public func generate(from configuration: TunnelKitProvider.Configuration, preferences: Preferences) throws -> TunnelKitProvider.Configuration {
public func generate(from configuration: OpenVPNTunnelProvider.Configuration, preferences: Preferences) throws -> OpenVPNTunnelProvider.Configuration {
guard let pool = pool else {
preconditionFailure("Nil pool?")
}

View File

@ -26,14 +26,14 @@
import Foundation
import TunnelKit
public extension SessionProxy.ConfigurationBuilder {
// mutating func copyCommunication(from other: SessionProxy.ConfigurationBuilder) {
public extension OpenVPN.ConfigurationBuilder {
// mutating func copyCommunication(from other: OpenVPN.ConfigurationBuilder) {
// cipher = other.cipher
// digest = other.digest
// compressionFraming = other.compressionFraming
// }
func canCommunicate(with other: SessionProxy.Configuration) -> Bool {
func canCommunicate(with other: OpenVPN.Configuration) -> Bool {
return
(cipher == other.cipher) &&
((digest == other.digest) || fallbackCipher.embedsDigest) &&

View File

@ -75,9 +75,9 @@ public class TransientStore {
}
}
public static var baseVPNConfiguration: TunnelKitProvider.ConfigurationBuilder {
let sessionBuilder = SessionProxy.ConfigurationBuilder()
var builder = TunnelKitProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build())
public static var baseVPNConfiguration: OpenVPNTunnelProvider.ConfigurationBuilder {
let sessionBuilder = OpenVPN.ConfigurationBuilder()
var builder = OpenVPNTunnelProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build())
builder.mtu = 1250
builder.shouldDebug = true
// builder.debugLogFormat = "$Dyyyy-MM-dd HH:mm:ss.SSS$d $L $N.$F:$l - $M"

View File

@ -26,7 +26,7 @@
import Foundation
import TunnelKit
// supports a subset of TunnelKitProvider.Configuration
// supports a subset of OpenVPNTunnelProvider.Configuration
// ignores new JSON keys
public struct InfrastructurePreset: Codable {
@ -90,7 +90,7 @@ public struct InfrastructurePreset: Codable {
public let comment: String
public let configuration: TunnelKitProvider.Configuration
public let configuration: OpenVPNTunnelProvider.Configuration
public let external: [ExternalKey: String]?
@ -107,13 +107,13 @@ public struct InfrastructurePreset: Codable {
case .ca:
let filename = pattern.replacingOccurrences(of: "${id}", with: pool.id)
let caURL = baseURL.appendingPathComponent(filename)
return CryptoContainer(pem: try String(contentsOf: caURL))
return OpenVPN.CryptoContainer(pem: try String(contentsOf: caURL))
case .wrapKeyData:
let filename = pattern.replacingOccurrences(of: "${id}", with: pool.id)
let tlsKeyURL = baseURL.appendingPathComponent(filename)
let file = try String(contentsOf: tlsKeyURL)
return StaticKey(file: file, direction: .client)
return OpenVPN.StaticKey(file: file, direction: .client)
case .hostname:
return pattern.replacingOccurrences(of: "${id}", with: pool.id)
@ -124,19 +124,19 @@ public struct InfrastructurePreset: Codable {
return nil
}
public func injectExternalConfiguration(_ configuration: inout TunnelKitProvider.ConfigurationBuilder, with infrastructureName: Infrastructure.Name, pool: Pool) throws {
public func injectExternalConfiguration(_ configuration: inout OpenVPNTunnelProvider.ConfigurationBuilder, with infrastructureName: Infrastructure.Name, pool: Pool) throws {
guard let external = external, !external.isEmpty else {
return
}
var sessionBuilder = configuration.sessionConfiguration.builder()
if let _ = external[.ca] {
sessionBuilder.ca = try externalConfiguration(forKey: .ca, infrastructureName: infrastructureName, pool: pool) as? CryptoContainer
sessionBuilder.ca = try externalConfiguration(forKey: .ca, infrastructureName: infrastructureName, pool: pool) as? OpenVPN.CryptoContainer
}
if let _ = external[.wrapKeyData] {
if let dummyWrap = sessionBuilder.tlsWrap {
if let staticKey = try externalConfiguration(forKey: .wrapKeyData, infrastructureName: infrastructureName, pool: pool) as? StaticKey {
sessionBuilder.tlsWrap = SessionProxy.TLSWrap(strategy: dummyWrap.strategy, key: staticKey)
if let staticKey = try externalConfiguration(forKey: .wrapKeyData, infrastructureName: infrastructureName, pool: pool) as? OpenVPN.StaticKey {
sessionBuilder.tlsWrap = OpenVPN.TLSWrap(strategy: dummyWrap.strategy, key: staticKey)
}
}
}
@ -168,17 +168,17 @@ public struct InfrastructurePreset: Codable {
let cfgContainer = try container.nestedContainer(keyedBy: ConfigurationKeys.self, forKey: .configuration)
var sessionBuilder = SessionProxy.ConfigurationBuilder()
sessionBuilder.cipher = try cfgContainer.decode(SessionProxy.Cipher.self, forKey: .cipher)
if let digest = try cfgContainer.decodeIfPresent(SessionProxy.Digest.self, forKey: .digest) {
var sessionBuilder = OpenVPN.ConfigurationBuilder()
sessionBuilder.cipher = try cfgContainer.decode(OpenVPN.Cipher.self, forKey: .cipher)
if let digest = try cfgContainer.decodeIfPresent(OpenVPN.Digest.self, forKey: .digest) {
sessionBuilder.digest = digest
}
sessionBuilder.compressionFraming = try cfgContainer.decode(SessionProxy.CompressionFraming.self, forKey: .compressionFraming)
sessionBuilder.compressionAlgorithm = try cfgContainer.decodeIfPresent(SessionProxy.CompressionAlgorithm.self, forKey: .compressionAlgorithm) ?? .disabled
sessionBuilder.ca = try cfgContainer.decodeIfPresent(CryptoContainer.self, forKey: .ca)
sessionBuilder.clientCertificate = try cfgContainer.decodeIfPresent(CryptoContainer.self, forKey: .clientCertificate)
sessionBuilder.clientKey = try cfgContainer.decodeIfPresent(CryptoContainer.self, forKey: .clientKey)
sessionBuilder.tlsWrap = try cfgContainer.decodeIfPresent(SessionProxy.TLSWrap.self, forKey: .tlsWrap)
sessionBuilder.compressionFraming = try cfgContainer.decode(OpenVPN.CompressionFraming.self, forKey: .compressionFraming)
sessionBuilder.compressionAlgorithm = try cfgContainer.decodeIfPresent(OpenVPN.CompressionAlgorithm.self, forKey: .compressionAlgorithm) ?? .disabled
sessionBuilder.ca = try cfgContainer.decodeIfPresent(OpenVPN.CryptoContainer.self, forKey: .ca)
sessionBuilder.clientCertificate = try cfgContainer.decodeIfPresent(OpenVPN.CryptoContainer.self, forKey: .clientCertificate)
sessionBuilder.clientKey = try cfgContainer.decodeIfPresent(OpenVPN.CryptoContainer.self, forKey: .clientKey)
sessionBuilder.tlsWrap = try cfgContainer.decodeIfPresent(OpenVPN.TLSWrap.self, forKey: .tlsWrap)
sessionBuilder.keepAliveInterval = try cfgContainer.decodeIfPresent(TimeInterval.self, forKey: .keepAliveSeconds)
sessionBuilder.renegotiatesAfter = try cfgContainer.decodeIfPresent(TimeInterval.self, forKey: .renegotiatesAfterSeconds)
sessionBuilder.endpointProtocols = try cfgContainer.decode([EndpointProtocol].self, forKey: .endpointProtocols)
@ -189,7 +189,7 @@ public struct InfrastructurePreset: Codable {
// default to server settings
sessionBuilder.routingPolicies = nil
let builder = TunnelKitProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build())
let builder = OpenVPNTunnelProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build())
configuration = builder.build()
}

View File

@ -198,7 +198,7 @@ public class StandardVPNProvider: VPNProvider {
return
}
do {
try session.sendProviderMessage(TunnelKitProvider.Message.dataCount.data) { (data) in
try session.sendProviderMessage(OpenVPNTunnelProvider.Message.dataCount.data) { (data) in
guard let data = data, data.count == 16 else {
DispatchQueue.main.async {
completionHandler(nil)
@ -250,7 +250,7 @@ public class StandardVPNProvider: VPNProvider {
private static func requestDebugLog(session: NETunnelProviderSession, completionHandler: @escaping (String?) -> Void) {
do {
try session.sendProviderMessage(TunnelKitProvider.Message.requestLog.data) { (data) in
try session.sendProviderMessage(OpenVPNTunnelProvider.Message.requestLog.data) { (data) in
guard let data = data, !data.isEmpty else {
completionHandler(nil)
return

View File

@ -5,13 +5,12 @@ use_frameworks!
load 'Podfile.include'
$tunnelkit_name = 'TunnelKit'
$tunnelkit_specs = ['Core', 'AppExtension', 'LZO']
#$tunnelkit_specs = ['OpenVPN', 'LZO']
$tunnelkit_specs = ['Protocols/OpenVPN', 'Extra/LZO']
def shared_pods
by_version('~> 1.7.1', $tunnelkit_name, $tunnelkit_specs)
#by_git('d06b2e1', $tunnelkit_name, $tunnelkit_specs)
#by_path('..', $tunnelkit_name, $tunnelkit_specs)
#pod_version $tunnelkit_name, $tunnelkit_specs, '~> 2.0.0'
pod_git $tunnelkit_name, $tunnelkit_specs, 'f3edd6e'
#pod_path $tunnelkit_name, $tunnelkit_specs, '..'
pod 'SSZipArchive'
end

View File

@ -1,18 +1,18 @@
$git_root = "https://github.com/passepartoutvpn"
def by_version(version, name, specs)
def pod_version(name, specs, version)
specs.each { |s|
pod "#{name}/#{s}", version
}
end
def by_git(sha, name, specs)
def pod_git(name, specs, sha)
specs.each { |s|
pod "#{name}/#{s}", :git => "#{$git_root}/#{name.downcase}", :commit => sha
}
end
def by_path(root, name, specs)
def pod_path(name, specs, root)
specs.each { |s|
pod "#{name}/#{s}", :path => "#{root}/#{name.downcase}"
}

View File

@ -1,22 +1,24 @@
PODS:
- MBProgressHUD (1.1.0)
- OpenSSL-Apple (1.1.0j.2)
- SSZipArchive (2.1.4)
- SSZipArchive (2.2.1)
- SwiftyBeaver (1.7.0)
- TunnelKit/AppExtension (1.7.1):
- TunnelKit/AppExtension (2.0.0):
- SwiftyBeaver
- TunnelKit/Core
- TunnelKit/Core (1.7.1):
- TunnelKit/Core (2.0.0):
- OpenSSL-Apple (~> 1.1.0j.2)
- SwiftyBeaver
- TunnelKit/LZO (1.7.1)
- TunnelKit/Extra/LZO (2.0.0)
- TunnelKit/Protocols/OpenVPN (2.0.0):
- TunnelKit/AppExtension
- TunnelKit/Core
DEPENDENCIES:
- MBProgressHUD
- SSZipArchive
- TunnelKit/AppExtension (~> 1.7.1)
- TunnelKit/Core (~> 1.7.1)
- TunnelKit/LZO (~> 1.7.1)
- TunnelKit/Extra/LZO (from `https://github.com/passepartoutvpn/tunnelkit`, commit `f3edd6e`)
- TunnelKit/Protocols/OpenVPN (from `https://github.com/passepartoutvpn/tunnelkit`, commit `f3edd6e`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
@ -24,15 +26,24 @@ SPEC REPOS:
- OpenSSL-Apple
- SSZipArchive
- SwiftyBeaver
- TunnelKit
EXTERNAL SOURCES:
TunnelKit:
:commit: f3edd6e
:git: https://github.com/passepartoutvpn/tunnelkit
CHECKOUT OPTIONS:
TunnelKit:
:commit: f3edd6e
:git: https://github.com/passepartoutvpn/tunnelkit
SPEC CHECKSUMS:
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
OpenSSL-Apple: e88e1eb314acb4a05e2348069790c4aa49f6d319
SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322
SSZipArchive: 8e859da2520142e09166bc9161967db296e9d02f
SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165
TunnelKit: d1e02dea5cb58ea0d4dbfcdcb387e653d148d800
TunnelKit: 821c15bb87aafae69eb8c63e4cc46d883fff8797
PODFILE CHECKSUM: fad46c04b9c9bee54cc740d6a4af257553ff635f
PODFILE CHECKSUM: b45e8f98f20b6c63f2735d1f038fb2e415601fbd
COCOAPODS: 1.6.1