Finish up renaming in headers and prefixes

This commit is contained in:
Davide De Rosa 2018-08-23 12:07:55 +02:00
parent fe665e8ad5
commit 4d03df7066
70 changed files with 203 additions and 203 deletions

View File

@ -111,15 +111,15 @@
0EFEB4742006D3C800F81029 /* CoreConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44A2006D3C800F81029 /* CoreConfiguration.swift */; };
0EFEB4752006D3C800F81029 /* Errors.m in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44B2006D3C800F81029 /* Errors.m */; };
0EFEB4762006D3C800F81029 /* DataPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44C2006D3C800F81029 /* DataPath.m */; };
0EFEB4782006D3C800F81029 /* PIATunnelProvider+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44F2006D3C800F81029 /* PIATunnelProvider+Configuration.swift */; };
0EFEB4792006D3C800F81029 /* PIATunnelProvider+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4502006D3C800F81029 /* PIATunnelProvider+Interaction.swift */; };
0EFEB47B2006D3C800F81029 /* PIATunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4522006D3C800F81029 /* PIATunnelProvider.swift */; };
0EFEB4782006D3C800F81029 /* TunnelKitProvider+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44F2006D3C800F81029 /* TunnelKitProvider+Configuration.swift */; };
0EFEB4792006D3C800F81029 /* TunnelKitProvider+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4502006D3C800F81029 /* TunnelKitProvider+Interaction.swift */; };
0EFEB47B2006D3C800F81029 /* TunnelKitProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4522006D3C800F81029 /* TunnelKitProvider.swift */; };
0EFEB4832006D3D000F81029 /* PIA-RSA-3072.pem in Resources */ = {isa = PBXBuildFile; fileRef = 0EFEB4802006D3D000F81029 /* PIA-RSA-3072.pem */; };
0EFEB4842006D3D000F81029 /* PIA-RSA-4096.pem in Resources */ = {isa = PBXBuildFile; fileRef = 0EFEB4812006D3D000F81029 /* PIA-RSA-4096.pem */; };
0EFEB4852006D3D000F81029 /* PIA-RSA-2048.pem in Resources */ = {isa = PBXBuildFile; fileRef = 0EFEB4822006D3D000F81029 /* PIA-RSA-2048.pem */; };
0EFEB4872006D7C400F81029 /* PIATunnelProvider+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44F2006D3C800F81029 /* PIATunnelProvider+Configuration.swift */; };
0EFEB4882006D7C400F81029 /* PIATunnelProvider+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4502006D3C800F81029 /* PIATunnelProvider+Interaction.swift */; };
0EFEB48A2006D7C400F81029 /* PIATunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4522006D3C800F81029 /* PIATunnelProvider.swift */; };
0EFEB4872006D7C400F81029 /* TunnelKitProvider+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44F2006D3C800F81029 /* TunnelKitProvider+Configuration.swift */; };
0EFEB4882006D7C400F81029 /* TunnelKitProvider+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4502006D3C800F81029 /* TunnelKitProvider+Interaction.swift */; };
0EFEB48A2006D7C400F81029 /* TunnelKitProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4522006D3C800F81029 /* TunnelKitProvider.swift */; };
0EFEB48D2006D7F300F81029 /* EncryptionProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB42A2006D3C800F81029 /* EncryptionProxy.swift */; };
0EFEB48E2006D7F300F81029 /* SessionKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB42B2006D3C800F81029 /* SessionKey.swift */; };
0EFEB4902006D7F300F81029 /* TunnelInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB42F2006D3C800F81029 /* TunnelInterface.swift */; };
@ -257,9 +257,9 @@
0EFEB44A2006D3C800F81029 /* CoreConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreConfiguration.swift; sourceTree = "<group>"; };
0EFEB44B2006D3C800F81029 /* Errors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Errors.m; sourceTree = "<group>"; };
0EFEB44C2006D3C800F81029 /* DataPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DataPath.m; sourceTree = "<group>"; };
0EFEB44F2006D3C800F81029 /* PIATunnelProvider+Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PIATunnelProvider+Configuration.swift"; sourceTree = "<group>"; };
0EFEB4502006D3C800F81029 /* PIATunnelProvider+Interaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PIATunnelProvider+Interaction.swift"; sourceTree = "<group>"; };
0EFEB4522006D3C800F81029 /* PIATunnelProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PIATunnelProvider.swift; sourceTree = "<group>"; };
0EFEB44F2006D3C800F81029 /* TunnelKitProvider+Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TunnelKitProvider+Configuration.swift"; sourceTree = "<group>"; };
0EFEB4502006D3C800F81029 /* TunnelKitProvider+Interaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TunnelKitProvider+Interaction.swift"; sourceTree = "<group>"; };
0EFEB4522006D3C800F81029 /* TunnelKitProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TunnelKitProvider.swift; sourceTree = "<group>"; };
0EFEB4802006D3D000F81029 /* PIA-RSA-3072.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "PIA-RSA-3072.pem"; sourceTree = "<group>"; };
0EFEB4812006D3D000F81029 /* PIA-RSA-4096.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "PIA-RSA-4096.pem"; sourceTree = "<group>"; };
0EFEB4822006D3D000F81029 /* PIA-RSA-2048.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "PIA-RSA-2048.pem"; sourceTree = "<group>"; };
@ -477,9 +477,9 @@
0EFEB4AA200760EC00F81029 /* InterfaceObserver.swift */,
0EFEB4AD2007625E00F81029 /* Keychain.swift */,
0EFEB4A9200760EB00F81029 /* MemoryDestination.swift */,
0EFEB4522006D3C800F81029 /* PIATunnelProvider.swift */,
0EFEB44F2006D3C800F81029 /* PIATunnelProvider+Configuration.swift */,
0EFEB4502006D3C800F81029 /* PIATunnelProvider+Interaction.swift */,
0EFEB4522006D3C800F81029 /* TunnelKitProvider.swift */,
0EFEB44F2006D3C800F81029 /* TunnelKitProvider+Configuration.swift */,
0EFEB4502006D3C800F81029 /* TunnelKitProvider+Interaction.swift */,
0EEC49DB20B5E732008FEB91 /* Utils.swift */,
);
path = AppExtension;
@ -900,7 +900,7 @@
0EFEB4632006D3C800F81029 /* ProtocolMacros.swift in Sources */,
0EFEB4AC200760EC00F81029 /* InterfaceObserver.swift in Sources */,
0EFEB46D2006D3C800F81029 /* Data+Manipulation.swift in Sources */,
0EFEB47B2006D3C800F81029 /* PIATunnelProvider.swift in Sources */,
0EFEB47B2006D3C800F81029 /* TunnelKitProvider.swift in Sources */,
0EFEB4742006D3C800F81029 /* CoreConfiguration.swift in Sources */,
0E07595F20EF6D1400F38FD8 /* CryptoCBC.m in Sources */,
0EC1BBA820D7D803007C4C7B /* ConnectionStrategy.swift in Sources */,
@ -910,12 +910,12 @@
0EBBF2F3208505D300E36B40 /* NEUDPInterface.swift in Sources */,
0EFEB4682006D3C800F81029 /* MSS.m in Sources */,
0EFEB45B2006D3C800F81029 /* TLSBox.m in Sources */,
0EFEB4792006D3C800F81029 /* PIATunnelProvider+Interaction.swift in Sources */,
0EFEB4792006D3C800F81029 /* TunnelKitProvider+Interaction.swift in Sources */,
0EFEB4702006D3C800F81029 /* Allocation.m in Sources */,
0EFEB4672006D3C800F81029 /* SessionProxy.swift in Sources */,
0EFEB4722006D3C800F81029 /* ReplayProtector.m in Sources */,
0EFEB4712006D3C800F81029 /* TunnelSettings.swift in Sources */,
0EFEB4782006D3C800F81029 /* PIATunnelProvider+Configuration.swift in Sources */,
0EFEB4782006D3C800F81029 /* TunnelKitProvider+Configuration.swift in Sources */,
0E3E0F212108A8CC00B371C1 /* PushReply.swift in Sources */,
0EFEB4752006D3C800F81029 /* Errors.m in Sources */,
0EBBF2E52084FE6F00E36B40 /* GenericSocket.swift in Sources */,
@ -932,9 +932,9 @@
0EBBF2F6208505D700E36B40 /* NETunnelInterface.swift in Sources */,
0EAAD70A20E4F2BC0088754A /* CommunicationType.swift in Sources */,
0EFEB4A12006D7F300F81029 /* LinkInterface.swift in Sources */,
0EFEB4872006D7C400F81029 /* PIATunnelProvider+Configuration.swift in Sources */,
0EFEB4872006D7C400F81029 /* TunnelKitProvider+Configuration.swift in Sources */,
0EBBF2F7208505DD00E36B40 /* NWUDPSessionState+Description.swift in Sources */,
0EFEB4882006D7C400F81029 /* PIATunnelProvider+Interaction.swift in Sources */,
0EFEB4882006D7C400F81029 /* TunnelKitProvider+Interaction.swift in Sources */,
0EE7A79920F6296F00B42E6A /* PacketMacros.m in Sources */,
0EEC49DD20B5E732008FEB91 /* Utils.swift in Sources */,
0EAAD70D20E4F85A0088754A /* LinkInterface+Strategy.swift in Sources */,
@ -945,7 +945,7 @@
0EBBF3012085196000E36B40 /* NWTCPConnectionState+Description.swift in Sources */,
0EFEB4962006D7F300F81029 /* ProtocolMacros.swift in Sources */,
0EE7A79620F61EDC00B42E6A /* PacketMacros.h in Sources */,
0EFEB48A2006D7C400F81029 /* PIATunnelProvider.swift in Sources */,
0EFEB48A2006D7C400F81029 /* TunnelKitProvider.swift in Sources */,
0EBBF2FB2085061600E36B40 /* NETCPInterface.swift in Sources */,
0EFEB4982006D7F300F81029 /* ZeroingData.swift in Sources */,
0EFEB4A32006D7F300F81029 /* Errors.m in Sources */,

View File

@ -1,6 +1,6 @@
//
// ConnectionStrategy.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 6/18/18.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -19,11 +19,11 @@ class ConnectionStrategy {
private var resolvedAddresses: [String]?
private let endpointProtocols: [PIATunnelProvider.EndpointProtocol]
private let endpointProtocols: [TunnelKitProvider.EndpointProtocol]
private var currentProtocolIndex = 0
init(hostname: String, configuration: PIATunnelProvider.Configuration) {
init(hostname: String, configuration: TunnelKitProvider.Configuration) {
precondition(!configuration.prefersResolvedAddresses || !(configuration.resolvedAddresses?.isEmpty ?? true))
self.hostname = hostname
@ -70,7 +70,7 @@ class ConnectionStrategy {
guard let targetAddress = self.resolvedAddress(from: addresses) else {
log.error("No resolved or fallback address available")
completionHandler(nil, PIATunnelProvider.ProviderError.dnsFailure)
completionHandler(nil, TunnelKitProvider.ProviderError.dnsFailure)
return
}
@ -90,7 +90,7 @@ class ConnectionStrategy {
return true
}
private func currentProtocol() -> PIATunnelProvider.EndpointProtocol {
private func currentProtocol() -> TunnelKitProvider.EndpointProtocol {
return endpointProtocols[currentProtocolIndex]
}
@ -111,7 +111,7 @@ class ConnectionStrategy {
}
private extension NEProvider {
func createSocket(to address: String, protocol endpointProtocol: PIATunnelProvider.EndpointProtocol) -> GenericSocket {
func createSocket(to address: String, protocol endpointProtocol: TunnelKitProvider.EndpointProtocol) -> GenericSocket {
let endpoint = NWHostEndpoint(hostname: address, port: "\(endpointProtocol.port)")
switch endpointProtocol.socketType {
case .udp:

View File

@ -1,6 +1,6 @@
//
// DNSResolver.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 12/15/17.
// Copyright © 2017 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// GenericSocket.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 4/16/18.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// InterfaceObserver.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 6/14/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// Keychain.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/12/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// MemoryDestination.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 7/26/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// LinkInterface+Strategy.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 6/28/18.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// NETCPInterface.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 4/15/18.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// NETunnelInterface.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 8/27/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// NEUDPInterface.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 8/27/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// NWTCPConnectionState+Description.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 4/16/18.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// NWUDPSessionState+Description.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 9/24/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// PIATunnelProvider+Configuration.swift
// PIATunnel
// TunnelKitProvider+Configuration.swift
// TunnelKit
//
// Created by Davide De Rosa on 10/23/17.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -12,7 +12,7 @@ import SwiftyBeaver
private let log = SwiftyBeaver.self
extension PIATunnelProvider {
extension TunnelKitProvider {
// MARK: Cryptography
@ -94,7 +94,7 @@ extension PIATunnelProvider {
return
}
let bundle = Bundle(for: PIATunnelProvider.self)
let bundle = Bundle(for: TunnelKitProvider.self)
let certName = "PIA-\(rawValue)"
guard let certUrl = bundle.url(forResource: certName, withExtension: "pem") else {
fatalError("Could not find \(certName) TLS certificate")
@ -105,7 +105,7 @@ extension PIATunnelProvider {
}
}
extension PIATunnelProvider {
extension TunnelKitProvider {
// MARK: Configuration
@ -192,7 +192,7 @@ extension PIATunnelProvider {
}
}
/// The way to create a `PIATunnelProvider.Configuration` object for the tunnel profile.
/// The way to create a `TunnelKitProvider.Configuration` object for the tunnel profile.
public struct ConfigurationBuilder {
// MARK: App group
@ -341,9 +341,9 @@ extension PIATunnelProvider {
}
/**
Builds a `PIATunnelProvider.Configuration` object that will connect to the provided endpoint.
Builds a `TunnelKitProvider.Configuration` object that will connect to the provided endpoint.
- Returns: A `PIATunnelProvider.Configuration` object with this builder and the additional method parameters.
- Returns: A `TunnelKitProvider.Configuration` object with this builder and the additional method parameters.
*/
public func build() -> Configuration {
return Configuration(
@ -364,7 +364,7 @@ extension PIATunnelProvider {
}
}
/// Offers a bridge between the abstract `PIATunnelProvider.ConfigurationBuilder` and a concrete `NETunnelProviderProtocol` profile.
/// Offers a bridge between the abstract `TunnelKitProvider.ConfigurationBuilder` and a concrete `NETunnelProviderProtocol` profile.
public struct Configuration {
struct Keys {
static let appGroup = "AppGroup"
@ -394,43 +394,43 @@ extension PIATunnelProvider {
static let debugLogFormat = "DebugLogFormat"
}
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.appGroup`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.appGroup`
public let appGroup: String
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.prefersResolvedAddresses`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.prefersResolvedAddresses`
public let prefersResolvedAddresses: Bool
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.resolvedAddresses`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.resolvedAddresses`
public let resolvedAddresses: [String]?
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.endpointProtocols`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.endpointProtocols`
public let endpointProtocols: [EndpointProtocol]
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.cipher`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.cipher`
public let cipher: Cipher
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.digest`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.digest`
public let digest: Digest
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.handshake`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.handshake`
public let handshake: Handshake
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.ca`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.ca`
public let ca: String?
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.mtu`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.mtu`
public let mtu: NSNumber
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.renegotiatesAfterSeconds`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.renegotiatesAfterSeconds`
public let renegotiatesAfterSeconds: Int?
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.shouldDebug`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.shouldDebug`
public let shouldDebug: Bool
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.debugLogKey`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.debugLogKey`
public let debugLogKey: String?
/// - Seealso: `PIATunnelProvider.ConfigurationBuilder.debugLogFormat`
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.debugLogFormat`
public let debugLogFormat: String?
// MARK: Shortcuts
@ -449,10 +449,10 @@ extension PIATunnelProvider {
// MARK: API
/**
Parses a new `PIATunnelProvider.Configuration` object from a provider configuration map.
Parses a new `TunnelKitProvider.Configuration` object from a provider configuration map.
- Parameter from: The map to parse.
- Returns: The parsed `PIATunnelProvider.Configuration` object.
- Returns: The parsed `TunnelKitProvider.Configuration` object.
- Throws: `ProviderError.configuration` if `providerConfiguration` is incomplete.
*/
public static func parsed(from providerConfiguration: [String: Any]) throws -> Configuration {
@ -502,7 +502,7 @@ extension PIATunnelProvider {
Generates a `NETunnelProviderProtocol` from this configuration.
- Parameter bundleIdentifier: The provider bundle identifier required to locate the tunnel extension.
- Parameter endpoint: The `PIATunnelProvider.AuthenticatedEndpoint` the tunnel will connect to.
- Parameter endpoint: The `TunnelKitProvider.AuthenticatedEndpoint` the tunnel will connect to.
- Returns: The generated `NETunnelProviderProtocol` object.
- Throws: `ProviderError.configuration` if unable to store the `endpoint.password` to the `appGroup` keychain.
*/
@ -548,15 +548,15 @@ extension PIATunnelProvider {
// MARK: Modification
extension PIATunnelProvider.Configuration: Equatable {
extension TunnelKitProvider.Configuration: Equatable {
/**
Returns a `PIATunnelProvider.ConfigurationBuilder` to use this configuration as a starting point for a new one.
Returns a `TunnelKitProvider.ConfigurationBuilder` to use this configuration as a starting point for a new one.
- Returns: An editable `PIATunnelProvider.ConfigurationBuilder` initialized with this configuration.
- Returns: An editable `TunnelKitProvider.ConfigurationBuilder` initialized with this configuration.
*/
public func builder() -> PIATunnelProvider.ConfigurationBuilder {
var builder = PIATunnelProvider.ConfigurationBuilder(appGroup: appGroup)
public func builder() -> TunnelKitProvider.ConfigurationBuilder {
var builder = TunnelKitProvider.ConfigurationBuilder(appGroup: appGroup)
builder.endpointProtocols = endpointProtocols
builder.cipher = cipher
builder.digest = digest
@ -569,7 +569,7 @@ extension PIATunnelProvider.Configuration: Equatable {
}
/// :nodoc:
public static func ==(lhs: PIATunnelProvider.Configuration, rhs: PIATunnelProvider.Configuration) -> Bool {
public static func ==(lhs: TunnelKitProvider.Configuration, rhs: TunnelKitProvider.Configuration) -> Bool {
return (
(lhs.endpointProtocols == rhs.endpointProtocols) &&
(lhs.cipher == rhs.cipher) &&

View File

@ -1,6 +1,6 @@
//
// PIATunnelProvider+Interaction.swift
// PIATunnel
// TunnelKitProvider+Interaction.swift
// TunnelKit
//
// Created by Davide De Rosa on 9/24/17.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -8,11 +8,11 @@
import Foundation
extension PIATunnelProvider {
extension TunnelKitProvider {
// MARK: Interaction
/// The messages accepted by `PIATunnelProvider`.
/// The messages accepted by `TunnelKitProvider`.
public class Message: Equatable {
/// Requests a snapshot of the latest debug log. Returns the log data decoded from UTF-8.
@ -42,10 +42,10 @@ extension PIATunnelProvider {
}
}
/// The errors raised by `PIATunnelProvider`.
/// The errors raised by `TunnelKitProvider`.
public enum ProviderError: Error {
/// The `PIATunnelProvider.Configuration` provided is incorrect or incomplete.
/// The `TunnelKitProvider.Configuration` provided is incorrect or incomplete.
case configuration(field: String)
/// Credentials are missing or protected (e.g. device locked).

View File

@ -1,6 +1,6 @@
//
// PIATunnelProvider.swift
// PIATunnel
// TunnelKitProvider.swift
// TunnelKit
//
// Created by Davide De Rosa on 2/1/17.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -15,7 +15,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 PIATunnelProvider: NEPacketTunnelProvider {
open class TunnelKitProvider: NEPacketTunnelProvider {
// MARK: Tweaks
@ -49,7 +49,7 @@ open class PIATunnelProvider: NEPacketTunnelProvider {
private let observer = InterfaceObserver()
private let tunnelQueue = DispatchQueue(label: PIATunnelProvider.description())
private let tunnelQueue = DispatchQueue(label: TunnelKitProvider.description())
private let prngSeedLength = 64
@ -305,7 +305,7 @@ open class PIATunnelProvider: NEPacketTunnelProvider {
}
}
extension PIATunnelProvider: GenericSocketDelegate {
extension TunnelKitProvider: GenericSocketDelegate {
// MARK: GenericSocketDelegate (tunnel queue)
@ -380,7 +380,7 @@ extension PIATunnelProvider: GenericSocketDelegate {
}
}
extension PIATunnelProvider: SessionProxyDelegate {
extension TunnelKitProvider: SessionProxyDelegate {
// MARK: SessionProxyDelegate (tunnel queue)
@ -444,7 +444,7 @@ extension PIATunnelProvider: SessionProxyDelegate {
}
}
extension PIATunnelProvider {
extension TunnelKitProvider {
// MARK: Helpers

View File

@ -1,6 +1,6 @@
//
// Utils.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 5/23/18.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// Allocation.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 5/5/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// Allocation.m
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 5/5/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// Authenticator.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/9/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// CommunicationType.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 6/28/18.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// CoreConfiguration.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 9/1/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// CryptoAEAD.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 06/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// CryptoAEAD.m
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 06/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -110,11 +110,11 @@ const NSInteger CryptoAEADTagLength = 16;
assert(self.extraLength >= PacketIdLength);
memcpy(self.cipherIVEnc, extra + self.extraPacketIdOffset, PacketIdLength);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxEnc, NULL, NULL, self.cipherIVEnc, -1);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxEnc, NULL, &x, extra, self.extraLength);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxEnc, dest + CryptoAEADTagLength, &l1, bytes, (int)length);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxEnc, dest + CryptoAEADTagLength + l1, &l2);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CIPHER_CTX_ctrl(self.cipherCtxEnc, EVP_CTRL_GCM_GET_TAG, CryptoAEADTagLength, dest);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxEnc, NULL, NULL, self.cipherIVEnc, -1);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxEnc, NULL, &x, extra, self.extraLength);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxEnc, dest + CryptoAEADTagLength, &l1, bytes, (int)length);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxEnc, dest + CryptoAEADTagLength + l1, &l2);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CIPHER_CTX_ctrl(self.cipherCtxEnc, EVP_CTRL_GCM_GET_TAG, CryptoAEADTagLength, dest);
*destLength = CryptoAEADTagLength + l1 + l2;
@ -124,7 +124,7 @@ const NSInteger CryptoAEADTagLength = 16;
// NSLog(@">>> ENC tag: %@", [NSData dataWithBytes:dest length:CryptoAEADTagLength]);
// NSLog(@">>> ENC dest: %@", [NSData dataWithBytes:dest + CryptoAEADTagLength length:*destLength - CryptoAEADTagLength]);
PIA_CRYPTO_RETURN_STATUS(code)
TUNNEL_CRYPTO_RETURN_STATUS(code)
}
- (id<DataPathEncrypter>)dataPathEncrypter
@ -173,11 +173,11 @@ const NSInteger CryptoAEADTagLength = 16;
assert(self.extraLength >= PacketIdLength);
memcpy(self.cipherIVDec, extra + self.extraPacketIdOffset, PacketIdLength);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxDec, NULL, NULL, self.cipherIVDec, -1);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CIPHER_CTX_ctrl(self.cipherCtxDec, EVP_CTRL_GCM_SET_TAG, CryptoAEADTagLength, (uint8_t *)bytes);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxDec, NULL, &x, extra, self.extraLength);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxDec, dest, &l1, bytes + CryptoAEADTagLength, (int)length - CryptoAEADTagLength);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxDec, dest + l1, &l2);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxDec, NULL, NULL, self.cipherIVDec, -1);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CIPHER_CTX_ctrl(self.cipherCtxDec, EVP_CTRL_GCM_SET_TAG, CryptoAEADTagLength, (uint8_t *)bytes);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxDec, NULL, &x, extra, self.extraLength);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxDec, dest, &l1, bytes + CryptoAEADTagLength, (int)length - CryptoAEADTagLength);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxDec, dest + l1, &l2);
*destLength = l1 + l2;
@ -187,7 +187,7 @@ const NSInteger CryptoAEADTagLength = 16;
// NSLog(@">>> DEC tag: %@", [NSData dataWithBytes:bytes length:CryptoAEADTagLength]);
// NSLog(@">>> DEC dest: %@", [NSData dataWithBytes:dest length:*destLength]);
PIA_CRYPTO_RETURN_STATUS(code)
TUNNEL_CRYPTO_RETURN_STATUS(code)
}
- (id<DataPathDecrypter>)dataPathDecrypter
@ -321,7 +321,7 @@ const NSInteger CryptoAEADTagLength = 16;
}
if (self.checkPeerId && !self.checkPeerId(packet.bytes)) {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeDataPathPeerIdMismatch);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeDataPathPeerIdMismatch);
}
return NO;
}

View File

@ -1,6 +1,6 @@
//
// CryptoBox.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/4/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// CryptoBox.m
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/4/17.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -78,7 +78,7 @@
if ([self.cipherAlgorithm hasSuffix:@"-cbc"]) {
if (!self.digestAlgorithm) {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeCryptoBoxAlgorithm);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeCryptoBoxAlgorithm);
}
return NO;
}
@ -95,7 +95,7 @@
// not supported
else {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeCryptoBoxAlgorithm);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeCryptoBoxAlgorithm);
}
return NO;
}
@ -123,15 +123,15 @@
int code = 1;
HMAC_CTX *ctx = HMAC_CTX_new();
PIA_CRYPTO_TRACK_STATUS(code) HMAC_CTX_reset(ctx);
PIA_CRYPTO_TRACK_STATUS(code) HMAC_Init_ex(ctx, secret, (int)secretLength, EVP_get_digestbyname([digestName cStringUsingEncoding:NSASCIIStringEncoding]), NULL);
PIA_CRYPTO_TRACK_STATUS(code) HMAC_Update(ctx, data, dataLength);
PIA_CRYPTO_TRACK_STATUS(code) HMAC_Final(ctx, hmac, &l);
TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_CTX_reset(ctx);
TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Init_ex(ctx, secret, (int)secretLength, EVP_get_digestbyname([digestName cStringUsingEncoding:NSASCIIStringEncoding]), NULL);
TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Update(ctx, data, dataLength);
TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Final(ctx, hmac, &l);
HMAC_CTX_free(ctx);
*hmacLength = l;
PIA_CRYPTO_RETURN_STATUS(code)
TUNNEL_CRYPTO_RETURN_STATUS(code)
}
@end

View File

@ -1,6 +1,6 @@
//
// CryptoCBC.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 06/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// CryptoCBC.m
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 06/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -120,22 +120,22 @@ const NSInteger CryptoCBCMaxHMACLength = 100;
if (RAND_bytes(outIV, self.cipherIVLength) != 1) {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeCryptoBoxRandomGenerator);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeCryptoBoxRandomGenerator);
}
return NO;
}
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxEnc, NULL, NULL, outIV, -1);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxEnc, outEncrypted, &l1, bytes, (int)length);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxEnc, outEncrypted + l1, &l2);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxEnc, NULL, NULL, outIV, -1);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxEnc, outEncrypted, &l1, bytes, (int)length);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxEnc, outEncrypted + l1, &l2);
PIA_CRYPTO_TRACK_STATUS(code) HMAC_Init_ex(self.hmacCtxEnc, NULL, 0, NULL, NULL);
PIA_CRYPTO_TRACK_STATUS(code) HMAC_Update(self.hmacCtxEnc, outIV, l1 + l2 + self.cipherIVLength);
PIA_CRYPTO_TRACK_STATUS(code) HMAC_Final(self.hmacCtxEnc, dest, &l3);
TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Init_ex(self.hmacCtxEnc, NULL, 0, NULL, NULL);
TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Update(self.hmacCtxEnc, outIV, l1 + l2 + self.cipherIVLength);
TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Final(self.hmacCtxEnc, dest, &l3);
*destLength = l1 + l2 + self.cipherIVLength + self.digestLength;
PIA_CRYPTO_RETURN_STATUS(code)
TUNNEL_CRYPTO_RETURN_STATUS(code)
}
- (id<DataPathEncrypter>)dataPathEncrypter
@ -180,24 +180,24 @@ const NSInteger CryptoCBCMaxHMACLength = 100;
int l1 = 0, l2 = 0;
int code = 1;
PIA_CRYPTO_TRACK_STATUS(code) HMAC_Init_ex(self.hmacCtxDec, NULL, 0, NULL, NULL);
PIA_CRYPTO_TRACK_STATUS(code) HMAC_Update(self.hmacCtxDec, bytes + self.digestLength, length - self.digestLength);
PIA_CRYPTO_TRACK_STATUS(code) HMAC_Final(self.hmacCtxDec, self.bufferDecHMAC, (unsigned *)&l1);
TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Init_ex(self.hmacCtxDec, NULL, 0, NULL, NULL);
TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Update(self.hmacCtxDec, bytes + self.digestLength, length - self.digestLength);
TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Final(self.hmacCtxDec, self.bufferDecHMAC, (unsigned *)&l1);
if (PIA_CRYPTO_SUCCESS(code) && CRYPTO_memcmp(self.bufferDecHMAC, bytes, self.digestLength) != 0) {
if (TUNNEL_CRYPTO_SUCCESS(code) && CRYPTO_memcmp(self.bufferDecHMAC, bytes, self.digestLength) != 0) {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeCryptoBoxHMAC);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeCryptoBoxHMAC);
}
return NO;
}
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxDec, NULL, NULL, iv, -1);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxDec, dest, &l1, encrypted, (int)length - self.digestLength - self.cipherIVLength);
PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxDec, dest + l1, &l2);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxDec, NULL, NULL, iv, -1);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxDec, dest, &l1, encrypted, (int)length - self.digestLength - self.cipherIVLength);
TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxDec, dest + l1, &l2);
*destLength = l1 + l2;
PIA_CRYPTO_RETURN_STATUS(code)
TUNNEL_CRYPTO_RETURN_STATUS(code)
}
- (id<DataPathDecrypter>)dataPathDecrypter
@ -308,7 +308,7 @@ const NSInteger CryptoCBCMaxHMACLength = 100;
}
if (self.checkPeerId && !self.checkPeerId(packet.bytes)) {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeDataPathPeerIdMismatch);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeDataPathPeerIdMismatch);
}
return NO;
}

View File

@ -1,6 +1,6 @@
//
// CryptoMacros.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 06/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -8,12 +8,12 @@
#import <Foundation/Foundation.h>
#define PIA_CRYPTO_SUCCESS(ret) (ret > 0)
#define PIA_CRYPTO_TRACK_STATUS(ret) if (ret > 0) ret =
#define PIA_CRYPTO_RETURN_STATUS(ret)\
#define TUNNEL_CRYPTO_SUCCESS(ret) (ret > 0)
#define TUNNEL_CRYPTO_TRACK_STATUS(ret) if (ret > 0) ret =
#define TUNNEL_CRYPTO_RETURN_STATUS(ret)\
if (ret <= 0) {\
if (error) {\
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeCryptoBoxEncryption);\
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeCryptoBoxEncryption);\
}\
return NO;\
}\

View File

@ -1,6 +1,6 @@
//
// Data+Manipulation.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/3/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// DataPath.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 3/2/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// DataPath.m
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 3/2/17.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -140,7 +140,7 @@
if (self.outPacketId > self.maxPacketId) {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeDataPathOverflow);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeDataPathOverflow);
}
return nil;
}
@ -202,7 +202,7 @@
}
if (packetId > self.maxPacketId) {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeDataPathOverflow);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeDataPathOverflow);
}
return nil;
}

View File

@ -1,6 +1,6 @@
//
// DataPathEncryption.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 11/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// Encryption.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 3/3/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// EncryptionProxy.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/8/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// Errors.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 10/10/17.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -8,20 +8,20 @@
#import <Foundation/Foundation.h>
extern NSString *const PIATunnelErrorDomain;
extern NSString *const TunnelKitErrorDomain;
typedef NS_ENUM(NSInteger, PIATunnelErrorCode) {
PIATunnelErrorCodeCryptoBoxRandomGenerator = 101,
PIATunnelErrorCodeCryptoBoxHMAC,
PIATunnelErrorCodeCryptoBoxEncryption,
PIATunnelErrorCodeCryptoBoxAlgorithm,
PIATunnelErrorCodeTLSBoxCA = 201,
PIATunnelErrorCodeTLSBoxHandshake,
PIATunnelErrorCodeTLSBoxGeneric,
PIATunnelErrorCodeDataPathOverflow = 301,
PIATunnelErrorCodeDataPathPeerIdMismatch
typedef NS_ENUM(NSInteger, TunnelKitErrorCode) {
TunnelKitErrorCodeCryptoBoxRandomGenerator = 101,
TunnelKitErrorCodeCryptoBoxHMAC,
TunnelKitErrorCodeCryptoBoxEncryption,
TunnelKitErrorCodeCryptoBoxAlgorithm,
TunnelKitErrorCodeTLSBoxCA = 201,
TunnelKitErrorCodeTLSBoxHandshake,
TunnelKitErrorCodeTLSBoxGeneric,
TunnelKitErrorCodeDataPathOverflow = 301,
TunnelKitErrorCodeDataPathPeerIdMismatch
};
static inline NSError *PIATunnelErrorWithCode(PIATunnelErrorCode code) {
return [NSError errorWithDomain:PIATunnelErrorDomain code:code userInfo:nil];
static inline NSError *TunnelKitErrorWithCode(TunnelKitErrorCode code) {
return [NSError errorWithDomain:TunnelKitErrorDomain code:code userInfo:nil];
}

View File

@ -1,6 +1,6 @@
//
// Errors.m
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 10/10/17.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -8,4 +8,4 @@
#import "Errors.h"
NSString *const PIATunnelErrorDomain = @"PIATunnelNative";
NSString *const TunnelKitErrorDomain = @"TunnelKitNative";

View File

@ -1,6 +1,6 @@
//
// IOInterface.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 8/27/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// LinkInterface.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 8/27/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// MSS.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/7/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// MSS.m
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/7/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// Packet.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/3/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// PacketMacros.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 11/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// PacketMacros.m
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 11/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// ProtocolMacros.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/8/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// PushReply.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 25/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// ReplayProtector.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/17/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// ReplayProtector.m
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/17/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// SecureRandom.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/3/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// SessionKey.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 4/12/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// SessionProxy.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/3/17.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -15,7 +15,7 @@ private let log = SwiftyBeaver.self
private extension Error {
func isDataPathOverflow() -> Bool {
let te = self as NSError
return te.domain == PIATunnelErrorDomain && te.code == PIATunnelErrorCode.dataPathOverflow.rawValue
return te.domain == TunnelKitErrorDomain && te.code == TunnelKitErrorCode.dataPathOverflow.rawValue
}
}

View File

@ -1,6 +1,6 @@
//
// TLSBox.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/3/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// TLSBox.m
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/3/17.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -89,7 +89,7 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) {
if (!SSL_CTX_load_verify_locations(self.ctx, [self.caPath cStringUsingEncoding:NSASCIIStringEncoding], NULL)) {
ERR_print_errors_fp(stdout);
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeTLSBoxCA);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeTLSBoxCA);
}
return NO;
}
@ -112,7 +112,7 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) {
if (!SSL_do_handshake(self.ssl)) {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeTLSBoxHandshake);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeTLSBoxHandshake);
}
return NO;
}
@ -135,7 +135,7 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) {
}
if ((ret < 0) && !BIO_should_retry(self.bioCipherTextOut)) {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeTLSBoxGeneric);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeTLSBoxGeneric);
}
}
return nil;
@ -153,7 +153,7 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) {
}
if ((ret < 0) && !BIO_should_retry(self.bioPlainText)) {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeTLSBoxGeneric);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeTLSBoxGeneric);
}
}
return NO;
@ -175,7 +175,7 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) {
const int ret = BIO_write(self.bioCipherTextIn, text, (int)length);
if (ret != length) {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeTLSBoxGeneric);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeTLSBoxGeneric);
}
return NO;
}
@ -196,7 +196,7 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) {
const int ret = BIO_write(self.bioPlainText, text, (int)length);
if (ret != length) {
if (error) {
*error = PIATunnelErrorWithCode(PIATunnelErrorCodeTLSBoxGeneric);
*error = TunnelKitErrorWithCode(TunnelKitErrorCodeTLSBoxGeneric);
}
return NO;
}

View File

@ -1,6 +1,6 @@
//
// TunnelInterface.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 8/27/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// TunnelSettings.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 2/7/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// ZeroingData.h
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 4/28/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// ZeroingData.m
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 4/28/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// ZeroingData.swift
// PIATunnel
// TunnelKit
//
// Created by Davide De Rosa on 4/27/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// AppDelegate.swift
// PIATunnelHost
// TunnelKitHost
//
// Created by Davide De Rosa on 9/24/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// ViewController.swift
// PIATunnelHost
// TunnelKitHost
//
// Created by Davide De Rosa on 9/24/17.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// AppExtensionTests.swift
// PIATunnelTests
// TunnelKitTests
//
// Created by Davide De Rosa on 10/23/17.
// Copyright © 2018 London Trust Media. All rights reserved.
@ -23,18 +23,18 @@ class AppExtensionTests: XCTestCase {
}
func testConfiguration() {
var builder: PIATunnelProvider.ConfigurationBuilder!
var cfg: PIATunnelProvider.Configuration!
var builder: TunnelKitProvider.ConfigurationBuilder!
var cfg: TunnelKitProvider.Configuration!
let identifier = "com.example.Provider"
let appGroup = "group.com.algoritmico.TunnelKit"
let endpoint = PIATunnelProvider.AuthenticatedEndpoint(
let endpoint = TunnelKitProvider.AuthenticatedEndpoint(
hostname: "example.com",
username: "foo",
password: "bar"
)
builder = PIATunnelProvider.ConfigurationBuilder(appGroup: appGroup)
builder = TunnelKitProvider.ConfigurationBuilder(appGroup: appGroup)
XCTAssertNotNil(builder)
builder.cipher = .aes128cbc
@ -54,7 +54,7 @@ class AppExtensionTests: XCTestCase {
print("\(pc)")
}
let K = PIATunnelProvider.Configuration.Keys.self
let K = TunnelKitProvider.Configuration.Keys.self
XCTAssertEqual(proto?.providerConfiguration?[K.appGroup] as? String, cfg.appGroup)
XCTAssertEqual(proto?.providerConfiguration?[K.cipherAlgorithm] as? String, cfg.cipher.rawValue)
XCTAssertEqual(proto?.providerConfiguration?[K.digestAlgorithm] as? String, cfg.digest.rawValue)

View File

@ -1,6 +1,6 @@
//
// DataManipulationTests.swift
// PIATunnelTests
// TunnelKitTests
//
// Created by Davide De Rosa on 07/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// DataPathEncryptionTests.swift
// PIATunnelTests
// TunnelKitTests
//
// Created by Davide De Rosa on 11/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// DataPathPerformanceTests.swift
// PIATunnelTests
// TunnelKitTests
//
// Created by Davide De Rosa on 07/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// EncryptionPerformanceTests.swift
// PIATunnelTests
// TunnelKitTests
//
// Created by Davide De Rosa on 07/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// EncryptionTests.swift
// PIATunnelTests
// TunnelKitTests
//
// Created by Davide De Rosa on 07/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// LinkTests.swift
// PIATunnelTests
// TunnelKitTests
//
// Created by Davide De Rosa on 07/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// RandomTests.swift
// PIATunnelTests
// TunnelKitTests
//
// Created by Davide De Rosa on 07/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// RawPerformanceTests.swift
// PIATunnelTests
// TunnelKitTests
//
// Created by Davide De Rosa on 07/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.

View File

@ -1,6 +1,6 @@
//
// TestUtils.swift
// PIATunnelTests
// TunnelKitTests
//
// Created by Davide De Rosa on 07/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.