Drop jazzy, will use DocC
This commit is contained in:
parent
bc776eda85
commit
9e14f33235
61
.jazzy.yaml
61
.jazzy.yaml
|
@ -1,61 +0,0 @@
|
|||
clean:
|
||||
module: "TunnelKit"
|
||||
author: "Davide De Rosa"
|
||||
author_url: "https://github.com/passepartoutvpn/tunnelkit"
|
||||
|
||||
theme: fullwidth
|
||||
|
||||
custom_categories:
|
||||
- name: Core
|
||||
children:
|
||||
- BidirectionalState
|
||||
- ConfigurationError
|
||||
- DNSProtocol
|
||||
- DNSResolver
|
||||
- DNSRecord
|
||||
- EndpointProtocol
|
||||
- IOInterface
|
||||
- IPv4Settings
|
||||
- IPv6Settings
|
||||
- LinkInterface
|
||||
- Proxy
|
||||
- Session
|
||||
- SocketType
|
||||
- TunnelInterface
|
||||
- IPHeader
|
||||
- name: AppExtension
|
||||
children:
|
||||
- GenericSocket
|
||||
- GenericSocketDelegate
|
||||
- InterfaceObserver
|
||||
- Keychain
|
||||
- KeychainError
|
||||
- LinkProducer
|
||||
- MemoryDestination
|
||||
- NETCPSocket
|
||||
- NETunnelInterface
|
||||
- NEUDPSocket
|
||||
- name: Manager
|
||||
children:
|
||||
- VPN
|
||||
- VPNConfiguration
|
||||
- VPNProvider
|
||||
- VPNProviderIPC
|
||||
- VPNStatus
|
||||
- NetworkExtensionLocator
|
||||
- NetworkExtensionNativeLocator
|
||||
- NetworkExtensionTunnelLocator
|
||||
- NetworkExtensionVPNConfiguration
|
||||
- NetworkExtensionVPNProvider
|
||||
- MockVPNProvider
|
||||
- name: Protocols/Native
|
||||
children:
|
||||
- NativeProvider
|
||||
- name: Protocols/OpenVPN
|
||||
children:
|
||||
- OpenVPN
|
||||
- OpenVPNError
|
||||
- OpenVPNProvider
|
||||
- OpenVPNSession
|
||||
- OpenVPNSessionDelegate
|
||||
- OpenVPNTunnelProvider
|
|
@ -44,7 +44,6 @@ public class MemoryDestination: BaseDestination, CustomStringConvertible {
|
|||
/// Max number of retained lines.
|
||||
public var maxLines: Int?
|
||||
|
||||
/// :nodoc:
|
||||
public override init() {
|
||||
super.init()
|
||||
asynchronously = false
|
||||
|
@ -76,7 +75,6 @@ public class MemoryDestination: BaseDestination, CustomStringConvertible {
|
|||
// MARK: BaseDestination
|
||||
|
||||
// XXX: executed in SwiftyBeaver queue. DO NOT invoke execute* here (sync in sync would crash otherwise)
|
||||
/// :nodoc:
|
||||
public override func send(_ level: SwiftyBeaver.Level, msg: String, thread: String, file: String, function: String, line: Int, context: Any?) -> String? {
|
||||
guard let message = super.send(level, msg: msg, thread: thread, file: file, function: function, line: line) else {
|
||||
return nil
|
||||
|
@ -92,7 +90,6 @@ public class MemoryDestination: BaseDestination, CustomStringConvertible {
|
|||
|
||||
// MARK: CustomStringConvertible
|
||||
|
||||
/// :nodoc:
|
||||
public var description: String {
|
||||
return executeSynchronously {
|
||||
return self.buffer.joined(separator: "\n")
|
||||
|
|
|
@ -45,10 +45,8 @@ private let log = SwiftyBeaver.self
|
|||
public class NETCPSocket: NSObject, GenericSocket {
|
||||
private static var linkContext = 0
|
||||
|
||||
/// :nodoc:
|
||||
public let impl: NWTCPConnection
|
||||
|
||||
/// :nodoc:
|
||||
public init(impl: NWTCPConnection) {
|
||||
self.impl = impl
|
||||
isActive = false
|
||||
|
@ -61,23 +59,18 @@ public class NETCPSocket: NSObject, GenericSocket {
|
|||
|
||||
private var isActive: Bool
|
||||
|
||||
/// :nodoc:
|
||||
public private(set) var isShutdown: Bool
|
||||
|
||||
/// :nodoc:
|
||||
public var remoteAddress: String? {
|
||||
return (impl.remoteAddress as? NWHostEndpoint)?.hostname
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public var hasBetterPath: Bool {
|
||||
return impl.hasBetterPath
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public weak var delegate: GenericSocketDelegate?
|
||||
|
||||
/// :nodoc:
|
||||
public func observe(queue: DispatchQueue, activeTimeout: Int) {
|
||||
isActive = false
|
||||
|
||||
|
@ -95,19 +88,16 @@ public class NETCPSocket: NSObject, GenericSocket {
|
|||
impl.addObserver(self, forKeyPath: #keyPath(NWTCPConnection.hasBetterPath), options: .new, context: &NETCPSocket.linkContext)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func unobserve() {
|
||||
impl.removeObserver(self, forKeyPath: #keyPath(NWTCPConnection.state), context: &NETCPSocket.linkContext)
|
||||
impl.removeObserver(self, forKeyPath: #keyPath(NWTCPConnection.hasBetterPath), context: &NETCPSocket.linkContext)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func shutdown() {
|
||||
impl.writeClose()
|
||||
impl.cancel()
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func upgraded() -> GenericSocket? {
|
||||
guard impl.hasBetterPath else {
|
||||
return nil
|
||||
|
@ -117,7 +107,6 @@ public class NETCPSocket: NSObject, GenericSocket {
|
|||
|
||||
// MARK: Connection KVO (any queue)
|
||||
|
||||
/// :nodoc:
|
||||
public override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
|
||||
guard (context == &NETCPSocket.linkContext) else {
|
||||
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
|
||||
|
@ -183,7 +172,6 @@ public class NETCPSocket: NSObject, GenericSocket {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension NETCPSocket {
|
||||
public override var description: String {
|
||||
guard let hostEndpoint = impl.endpoint as? NWHostEndpoint else {
|
||||
|
|
|
@ -45,21 +45,18 @@ private let log = SwiftyBeaver.self
|
|||
public class NETunnelInterface: TunnelInterface {
|
||||
private weak var impl: NEPacketTunnelFlow?
|
||||
|
||||
/// :nodoc:
|
||||
public init(impl: NEPacketTunnelFlow) {
|
||||
self.impl = impl
|
||||
}
|
||||
|
||||
// MARK: TunnelInterface
|
||||
|
||||
/// :nodoc:
|
||||
public var isPersistent: Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// MARK: IOInterface
|
||||
|
||||
/// :nodoc:
|
||||
public func setReadHandler(queue: DispatchQueue, _ handler: @escaping ([Data]?, Error?) -> Void) {
|
||||
loopReadPackets(queue, handler)
|
||||
}
|
||||
|
@ -75,14 +72,12 @@ public class NETunnelInterface: TunnelInterface {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func writePacket(_ packet: Data, completionHandler: ((Error?) -> Void)?) {
|
||||
let protocolNumber = IPHeader.protocolNumber(inPacket: packet)
|
||||
impl?.writePackets([packet], withProtocols: [protocolNumber])
|
||||
completionHandler?(nil)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func writePackets(_ packets: [Data], completionHandler: ((Error?) -> Void)?) {
|
||||
let protocols = packets.map {
|
||||
IPHeader.protocolNumber(inPacket: $0)
|
||||
|
|
|
@ -45,10 +45,8 @@ private let log = SwiftyBeaver.self
|
|||
public class NEUDPSocket: NSObject, GenericSocket {
|
||||
private static var linkContext = 0
|
||||
|
||||
/// :nodoc:
|
||||
public let impl: NWUDPSession
|
||||
|
||||
/// :nodoc:
|
||||
public init(impl: NWUDPSession) {
|
||||
self.impl = impl
|
||||
|
||||
|
@ -62,23 +60,18 @@ public class NEUDPSocket: NSObject, GenericSocket {
|
|||
|
||||
private var isActive: Bool
|
||||
|
||||
/// :nodoc:
|
||||
public private(set) var isShutdown: Bool
|
||||
|
||||
/// :nodoc:
|
||||
public var remoteAddress: String? {
|
||||
return (impl.resolvedEndpoint as? NWHostEndpoint)?.hostname
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public var hasBetterPath: Bool {
|
||||
return impl.hasBetterPath
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public weak var delegate: GenericSocketDelegate?
|
||||
|
||||
/// :nodoc:
|
||||
public func observe(queue: DispatchQueue, activeTimeout: Int) {
|
||||
isActive = false
|
||||
|
||||
|
@ -96,18 +89,15 @@ public class NEUDPSocket: NSObject, GenericSocket {
|
|||
impl.addObserver(self, forKeyPath: #keyPath(NWUDPSession.hasBetterPath), options: .new, context: &NEUDPSocket.linkContext)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func unobserve() {
|
||||
impl.removeObserver(self, forKeyPath: #keyPath(NWUDPSession.state), context: &NEUDPSocket.linkContext)
|
||||
impl.removeObserver(self, forKeyPath: #keyPath(NWUDPSession.hasBetterPath), context: &NEUDPSocket.linkContext)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func shutdown() {
|
||||
impl.cancel()
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func upgraded() -> GenericSocket? {
|
||||
guard impl.hasBetterPath else {
|
||||
return nil
|
||||
|
@ -117,7 +107,6 @@ public class NEUDPSocket: NSObject, GenericSocket {
|
|||
|
||||
// MARK: Connection KVO (any queue)
|
||||
|
||||
/// :nodoc:
|
||||
public override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
|
||||
guard (context == &NEUDPSocket.linkContext) else {
|
||||
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
|
||||
|
@ -186,7 +175,6 @@ public class NEUDPSocket: NSObject, GenericSocket {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension NEUDPSocket {
|
||||
public override var description: String {
|
||||
guard let hostEndpoint = impl.endpoint as? NWHostEndpoint else {
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
import Foundation
|
||||
import NetworkExtension
|
||||
|
||||
/// :nodoc:
|
||||
extension NWTCPConnectionState: CustomStringConvertible {
|
||||
public var description: String {
|
||||
switch self {
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
import Foundation
|
||||
import NetworkExtension
|
||||
|
||||
/// :nodoc:
|
||||
extension NWUDPSessionState: CustomStringConvertible {
|
||||
public var description: String {
|
||||
switch self {
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
/// :nodoc:
|
||||
public class CoreConfiguration {
|
||||
public static let identifier = "com.algoritmico.TunnelKit"
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ public struct DNSRecord {
|
|||
/// `true` if IPv6.
|
||||
public let isIPv6: Bool
|
||||
|
||||
/// :nodoc:
|
||||
public init(address: String, isIPv6: Bool) {
|
||||
self.address = address
|
||||
self.isIPv6 = isIPv6
|
||||
|
|
|
@ -34,7 +34,6 @@ public struct EndpointProtocol: RawRepresentable, Equatable, CustomStringConvert
|
|||
/// The remote port.
|
||||
public let port: UInt16
|
||||
|
||||
/// :nodoc:
|
||||
public init(_ socketType: SocketType, _ port: UInt16) {
|
||||
self.socketType = socketType
|
||||
self.port = port
|
||||
|
@ -42,7 +41,6 @@ public struct EndpointProtocol: RawRepresentable, Equatable, CustomStringConvert
|
|||
|
||||
// MARK: RawRepresentable
|
||||
|
||||
/// :nodoc:
|
||||
public init?(rawValue: String) {
|
||||
let components = rawValue.components(separatedBy: ":")
|
||||
guard components.count == 2 else {
|
||||
|
@ -57,27 +55,23 @@ public struct EndpointProtocol: RawRepresentable, Equatable, CustomStringConvert
|
|||
self.init(socketType, port)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public var rawValue: String {
|
||||
return "\(socketType.rawValue):\(port)"
|
||||
}
|
||||
|
||||
// MARK: Equatable
|
||||
|
||||
/// :nodoc:
|
||||
public static func ==(lhs: EndpointProtocol, rhs: EndpointProtocol) -> Bool {
|
||||
return (lhs.socketType == rhs.socketType) && (lhs.port == rhs.port)
|
||||
}
|
||||
|
||||
// MARK: CustomStringConvertible
|
||||
|
||||
/// :nodoc:
|
||||
public var description: String {
|
||||
return rawValue
|
||||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension EndpointProtocol: Codable {
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
|
|
|
@ -40,7 +40,6 @@ public struct IPv4Settings: Codable, CustomStringConvertible {
|
|||
/// The address of the gateway (uses default gateway if not set).
|
||||
public let gateway: String
|
||||
|
||||
/// :nodoc:
|
||||
public init(_ destination: String, _ mask: String?, _ gateway: String) {
|
||||
self.destination = destination
|
||||
self.mask = mask ?? "255.255.255.255"
|
||||
|
@ -49,7 +48,6 @@ public struct IPv4Settings: Codable, CustomStringConvertible {
|
|||
|
||||
// MARK: CustomStringConvertible
|
||||
|
||||
/// :nodoc:
|
||||
public var description: String {
|
||||
return "{\(destination.maskedDescription)/\(mask) \(gateway.maskedDescription)}"
|
||||
}
|
||||
|
@ -67,7 +65,6 @@ public struct IPv4Settings: Codable, CustomStringConvertible {
|
|||
/// The additional routes.
|
||||
public let routes: [Route]
|
||||
|
||||
/// :nodoc:
|
||||
public init(address: String, addressMask: String, defaultGateway: String, routes: [Route]) {
|
||||
self.address = address
|
||||
self.addressMask = addressMask
|
||||
|
@ -77,7 +74,6 @@ public struct IPv4Settings: Codable, CustomStringConvertible {
|
|||
|
||||
// MARK: CustomStringConvertible
|
||||
|
||||
/// :nodoc:
|
||||
public var description: String {
|
||||
return "addr \(address.maskedDescription) netmask \(addressMask) gw \(defaultGateway.maskedDescription) routes \(routes.map { $0.maskedDescription })"
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ public struct IPv6Settings: Codable, CustomStringConvertible {
|
|||
/// The address of the gateway (uses default gateway if not set).
|
||||
public let gateway: String
|
||||
|
||||
/// :nodoc:
|
||||
public init(_ destination: String, _ prefixLength: UInt8?, _ gateway: String) {
|
||||
self.destination = destination
|
||||
self.prefixLength = prefixLength ?? 3
|
||||
|
@ -49,7 +48,6 @@ public struct IPv6Settings: Codable, CustomStringConvertible {
|
|||
|
||||
// MARK: CustomStringConvertible
|
||||
|
||||
/// :nodoc:
|
||||
public var description: String {
|
||||
return "{\(destination.maskedDescription)/\(prefixLength) \(gateway.maskedDescription)}"
|
||||
}
|
||||
|
@ -67,7 +65,6 @@ public struct IPv6Settings: Codable, CustomStringConvertible {
|
|||
/// The additional routes.
|
||||
public let routes: [Route]
|
||||
|
||||
/// :nodoc:
|
||||
public init(address: String, addressPrefixLength: UInt8, defaultGateway: String, routes: [Route]) {
|
||||
self.address = address
|
||||
self.addressPrefixLength = addressPrefixLength
|
||||
|
@ -77,7 +74,6 @@ public struct IPv6Settings: Codable, CustomStringConvertible {
|
|||
|
||||
// MARK: CustomStringConvertible
|
||||
|
||||
/// :nodoc:
|
||||
public var description: String {
|
||||
return "addr \(address.maskedDescription)/\(addressPrefixLength) gw \(defaultGateway.maskedDescription) routes \(routes.map { $0.maskedDescription })"
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ public struct Proxy: Codable, RawRepresentable, CustomStringConvertible {
|
|||
/// The proxy port.
|
||||
public let port: UInt16
|
||||
|
||||
/// :nodoc:
|
||||
public init(_ address: String, _ port: UInt16) {
|
||||
self.address = address
|
||||
self.port = port
|
||||
|
@ -42,12 +41,10 @@ public struct Proxy: Codable, RawRepresentable, CustomStringConvertible {
|
|||
|
||||
// MARK: RawRepresentable
|
||||
|
||||
/// :nodoc:
|
||||
public var rawValue: String {
|
||||
return "\(address):\(port)"
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public init?(rawValue: String) {
|
||||
let comps = rawValue.components(separatedBy: ":")
|
||||
guard comps.count == 2, let port = UInt16(comps[1]) else {
|
||||
|
@ -58,7 +55,6 @@ public struct Proxy: Codable, RawRepresentable, CustomStringConvertible {
|
|||
|
||||
// MARK: CustomStringConvertible
|
||||
|
||||
/// :nodoc:
|
||||
public var description: String {
|
||||
return rawValue
|
||||
}
|
||||
|
|
|
@ -39,12 +39,10 @@ import Security.SecRandom
|
|||
import CTunnelKitCore
|
||||
import __TunnelKitUtils
|
||||
|
||||
/// :nodoc:
|
||||
public enum SecureRandomError: Error {
|
||||
case randomGenerator
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public class SecureRandom {
|
||||
@available(*, deprecated)
|
||||
static func uint32FromBuffer() throws -> UInt32 {
|
||||
|
|
|
@ -30,7 +30,6 @@ import TunnelKitManager
|
|||
public class NativeProvider: VPNProvider {
|
||||
private let provider: NetworkExtensionVPNProvider
|
||||
|
||||
/// :nodoc:
|
||||
public init() {
|
||||
provider = NetworkExtensionVPNProvider(locator: NetworkExtensionNativeLocator())
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import Foundation
|
|||
/// Simulates a VPN provider.
|
||||
public class MockVPNProvider: VPNProvider, VPNProviderIPC {
|
||||
|
||||
/// :nodoc:
|
||||
public init() {
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ public protocol NetworkExtensionLocator {
|
|||
/// Locator for native VPN protocols.
|
||||
public class NetworkExtensionNativeLocator: NetworkExtensionLocator {
|
||||
|
||||
/// :nodoc:
|
||||
public init() {
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import NetworkExtension
|
|||
/// A `VPNConfiguration` built on top of NetworkExtension entities.
|
||||
public struct NetworkExtensionVPNConfiguration: VPNConfiguration {
|
||||
|
||||
/// :nodoc:
|
||||
public var title: String
|
||||
|
||||
/// The `NEVPNProtocol` object embedding tunnel configuration.
|
||||
|
@ -38,7 +37,6 @@ public struct NetworkExtensionVPNConfiguration: VPNConfiguration {
|
|||
/// The on-demand rules to establish.
|
||||
public let onDemandRules: [NEOnDemandRule]
|
||||
|
||||
/// :nodoc:
|
||||
public init(title: String, protocolConfiguration: NEVPNProtocol, onDemandRules: [NEOnDemandRule]) {
|
||||
self.title = title
|
||||
self.protocolConfiguration = protocolConfiguration
|
||||
|
|
|
@ -98,7 +98,6 @@ class NETCPLink: LinkInterface {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension NETCPSocket: LinkProducer {
|
||||
public func link(xorMask: UInt8?) -> LinkInterface {
|
||||
return NETCPLink(impl: impl, maxPacketSize: nil, xorMask: xorMask)
|
||||
|
|
|
@ -101,7 +101,6 @@ class NEUDPLink: LinkInterface {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension NEUDPSocket: LinkProducer {
|
||||
public func link(xorMask: UInt8?) -> LinkInterface {
|
||||
return NEUDPLink(impl: impl, maxDatagrams: nil, xorMask: xorMask)
|
||||
|
|
|
@ -141,14 +141,12 @@ open class OpenVPNTunnelProvider: NEPacketTunnelProvider {
|
|||
|
||||
// MARK: NEPacketTunnelProvider (XPC queue)
|
||||
|
||||
/// :nodoc:
|
||||
open override var reasserting: Bool {
|
||||
didSet {
|
||||
log.debug("Reasserting flag \(reasserting ? "set" : "cleared")")
|
||||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
open override func startTunnel(options: [String : NSObject]? = nil, completionHandler: @escaping (Error?) -> Void) {
|
||||
|
||||
// required configuration
|
||||
|
@ -262,7 +260,6 @@ open class OpenVPNTunnelProvider: NEPacketTunnelProvider {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
open override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
|
||||
pendingStartHandler = nil
|
||||
log.info("Stopping tunnel...")
|
||||
|
@ -293,7 +290,6 @@ open class OpenVPNTunnelProvider: NEPacketTunnelProvider {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
open override func handleAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) {
|
||||
var response: Data?
|
||||
switch OpenVPNProvider.Message(messageData) {
|
||||
|
@ -321,12 +317,10 @@ open class OpenVPNTunnelProvider: NEPacketTunnelProvider {
|
|||
|
||||
// MARK: Wake/Sleep (debugging placeholders)
|
||||
|
||||
/// :nodoc:
|
||||
open override func wake() {
|
||||
log.verbose("Wake signal received")
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
open override func sleep(completionHandler: @escaping () -> Void) {
|
||||
log.verbose("Sleep signal received")
|
||||
completionHandler()
|
||||
|
@ -439,7 +433,6 @@ extension OpenVPNTunnelProvider: GenericSocketDelegate {
|
|||
|
||||
// MARK: GenericSocketDelegate (tunnel queue)
|
||||
|
||||
/// :nodoc:
|
||||
public func socketDidTimeout(_ socket: GenericSocket) {
|
||||
log.debug("Socket timed out waiting for activity, cancelling...")
|
||||
shouldReconnect = true
|
||||
|
@ -454,7 +447,6 @@ extension OpenVPNTunnelProvider: GenericSocketDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func socketDidBecomeActive(_ socket: GenericSocket) {
|
||||
guard let session = session, let producer = socket as? LinkProducer else {
|
||||
return
|
||||
|
@ -467,7 +459,6 @@ extension OpenVPNTunnelProvider: GenericSocketDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func socket(_ socket: GenericSocket, didShutdownWithFailure failure: Bool) {
|
||||
guard let session = session else {
|
||||
return
|
||||
|
@ -522,7 +513,6 @@ extension OpenVPNTunnelProvider: GenericSocketDelegate {
|
|||
disposeTunnel(error: shutdownError)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func socketHasBetterPath(_ socket: GenericSocket) {
|
||||
log.debug("Stopping tunnel due to a new better path")
|
||||
logCurrentSSID()
|
||||
|
@ -534,7 +524,6 @@ extension OpenVPNTunnelProvider: OpenVPNSessionDelegate {
|
|||
|
||||
// MARK: OpenVPNSessionDelegate (tunnel queue)
|
||||
|
||||
/// :nodoc:
|
||||
public func sessionDidStart(_ session: OpenVPNSession, remoteAddress: String, options: OpenVPN.Configuration) {
|
||||
log.info("Session did start")
|
||||
|
||||
|
@ -599,7 +588,6 @@ extension OpenVPNTunnelProvider: OpenVPNSessionDelegate {
|
|||
refreshDataCount()
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func sessionDidStop(_: OpenVPNSession, withError error: Error?, shouldReconnect: Bool) {
|
||||
if let error = error {
|
||||
log.error("Session did stop with error: \(error)")
|
||||
|
|
|
@ -40,7 +40,6 @@ extension OpenVPN {
|
|||
/// Any other compression algorithm (unsupported).
|
||||
case other
|
||||
|
||||
/// :nodoc:
|
||||
public var native: CompressionAlgorithmNative {
|
||||
guard let val = CompressionAlgorithmNative(rawValue: rawValue) else {
|
||||
fatalError("Unhandled CompressionAlgorithm bridging")
|
||||
|
@ -50,7 +49,6 @@ extension OpenVPN {
|
|||
|
||||
// MARK: CustomStringConvertible
|
||||
|
||||
/// :nodoc:
|
||||
public var description: String {
|
||||
switch self {
|
||||
case .disabled:
|
||||
|
|
|
@ -43,7 +43,6 @@ extension OpenVPN {
|
|||
/// Framing compatible with 2.4 `compress` (version 2, e.g. stub-v2).
|
||||
case compressV2
|
||||
|
||||
/// :nodoc:
|
||||
public var native: CompressionFramingNative {
|
||||
guard let val = CompressionFramingNative(rawValue: rawValue) else {
|
||||
fatalError("Unhandled CompressionFraming bridging")
|
||||
|
@ -53,7 +52,6 @@ extension OpenVPN {
|
|||
|
||||
// MARK: CustomStringConvertible
|
||||
|
||||
/// :nodoc:
|
||||
public var description: String {
|
||||
switch self {
|
||||
case .disabled:
|
||||
|
|
|
@ -59,7 +59,6 @@ extension OpenVPN {
|
|||
|
||||
// MARK: Equatable
|
||||
|
||||
/// :nodoc:
|
||||
public static func ==(lhs: Credentials, rhs: Credentials) -> Bool {
|
||||
return (lhs.username == rhs.username) && (lhs.password == rhs.password)
|
||||
}
|
||||
|
@ -112,7 +111,6 @@ extension OpenVPN {
|
|||
return rawValue.hasSuffix("-GCM") ? "AES-GCM" : "AES-CBC"
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public var description: String {
|
||||
return rawValue
|
||||
}
|
||||
|
@ -143,7 +141,6 @@ extension OpenVPN {
|
|||
return "HMAC"
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public var description: String {
|
||||
return "\(genericName)-\(rawValue)"
|
||||
}
|
||||
|
@ -162,7 +159,6 @@ extension OpenVPN {
|
|||
case blockLocal
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
private struct Fallback {
|
||||
static let cipher: Cipher = .aes128cbc
|
||||
|
||||
|
@ -301,7 +297,6 @@ extension OpenVPN {
|
|||
/// Policies for redirecting traffic through the VPN gateway.
|
||||
public var routingPolicies: [RoutingPolicy]?
|
||||
|
||||
/// :nodoc:
|
||||
public init() {
|
||||
}
|
||||
|
||||
|
@ -352,22 +347,18 @@ extension OpenVPN {
|
|||
|
||||
// MARK: Shortcuts
|
||||
|
||||
/// :nodoc:
|
||||
public var fallbackCipher: Cipher {
|
||||
return cipher ?? Fallback.cipher
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public var fallbackDigest: Digest {
|
||||
return digest ?? Fallback.digest
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public var fallbackCompressionFraming: CompressionFraming {
|
||||
return compressionFraming ?? Fallback.compressionFraming
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public var fallbackCompressionAlgorithm: CompressionAlgorithm {
|
||||
return compressionAlgorithm ?? Fallback.compressionAlgorithm
|
||||
}
|
||||
|
@ -483,17 +474,14 @@ extension OpenVPN {
|
|||
|
||||
// MARK: Shortcuts
|
||||
|
||||
/// :nodoc:
|
||||
public var fallbackCipher: Cipher {
|
||||
return cipher ?? Fallback.cipher
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public var fallbackDigest: Digest {
|
||||
return digest ?? Fallback.digest
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public var fallbackCompressionFraming: CompressionFraming {
|
||||
return compressionFraming ?? Fallback.compressionFraming
|
||||
}
|
||||
|
@ -554,7 +542,6 @@ extension OpenVPN.Configuration {
|
|||
|
||||
extension OpenVPN.Configuration {
|
||||
|
||||
/// :nodoc:
|
||||
public func print() {
|
||||
guard let endpointProtocols = endpointProtocols else {
|
||||
fatalError("No sessionConfiguration.endpointProtocols set")
|
||||
|
|
|
@ -84,7 +84,6 @@ extension OpenVPN {
|
|||
|
||||
// MARK: Server
|
||||
|
||||
/// :nodoc:
|
||||
public static let authToken = NSRegularExpression("^auth-token +[a-zA-Z0-9/=+]+")
|
||||
|
||||
static let peerId = NSRegularExpression("^peer-id +[0-9]+")
|
||||
|
|
|
@ -54,7 +54,6 @@ extension OpenVPN {
|
|||
return pem.contains("ENCRYPTED")
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public init(pem: String) {
|
||||
guard let beginRange = pem.range(of: CryptoContainer.begin) else {
|
||||
self.pem = ""
|
||||
|
@ -75,21 +74,18 @@ extension OpenVPN {
|
|||
|
||||
// MARK: Equatable
|
||||
|
||||
/// :nodoc:
|
||||
public static func ==(lhs: CryptoContainer, rhs: CryptoContainer) -> Bool {
|
||||
return lhs.pem == rhs.pem
|
||||
}
|
||||
|
||||
// MARK: Codable
|
||||
|
||||
/// :nodoc:
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
let pem = try container.decode(String.self)
|
||||
self.init(pem: pem)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(pem)
|
||||
|
|
|
@ -61,7 +61,6 @@ extension OpenVPN {
|
|||
|
||||
private let secureData: ZeroingData
|
||||
|
||||
/// :nodoc:
|
||||
public let direction: Direction?
|
||||
|
||||
/// Returns the encryption key.
|
||||
|
@ -153,7 +152,6 @@ extension OpenVPN {
|
|||
self.init(lines: lines, direction: direction)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public convenience init?(lines: [Substring], direction: Direction?) {
|
||||
var isHead = true
|
||||
var hexLines: [Substring] = []
|
||||
|
@ -208,26 +206,22 @@ extension OpenVPN {
|
|||
return secureData.withOffset(at * size, count: size)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public static func deserialized(_ data: Data) throws -> StaticKey {
|
||||
return try JSONDecoder().decode(StaticKey.self, from: data)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func serialized() -> Data? {
|
||||
return try? JSONEncoder().encode(self)
|
||||
}
|
||||
|
||||
// MARK: Codable
|
||||
|
||||
/// :nodoc:
|
||||
public required init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
secureData = Z(try container.decode(Data.self, forKey: .data))
|
||||
direction = try container.decodeIfPresent(Direction.self, forKey: .dir)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(secureData.toData(), forKey: .data)
|
||||
|
|
|
@ -46,18 +46,15 @@ extension OpenVPN {
|
|||
/// The static encryption key.
|
||||
public let key: StaticKey
|
||||
|
||||
/// :nodoc:
|
||||
public init(strategy: Strategy, key: StaticKey) {
|
||||
self.strategy = strategy
|
||||
self.key = key
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public static func deserialized(_ data: Data) throws -> TLSWrap {
|
||||
return try JSONDecoder().decode(TLSWrap.self, from: data)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func serialized() -> Data? {
|
||||
return try? JSONEncoder().encode(self)
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ extension OpenVPNProvider {
|
|||
/// The way to create a `OpenVPNProvider.Configuration` object for the tunnel profile.
|
||||
public struct ConfigurationBuilder {
|
||||
|
||||
/// :nodoc:
|
||||
public static let defaults = Configuration(
|
||||
sessionConfiguration: OpenVPN.ConfigurationBuilder().build(),
|
||||
prefersResolvedAddresses: false,
|
||||
|
@ -154,7 +153,6 @@ extension OpenVPNProvider {
|
|||
|
||||
static let debugLogFilename = "debug.log"
|
||||
|
||||
/// :nodoc:
|
||||
public static let lastErrorKey = "TunnelKitLastError"
|
||||
|
||||
fileprivate static let dataCountKey = "TunnelKitDataCount"
|
||||
|
@ -304,7 +302,6 @@ extension OpenVPNProvider {
|
|||
return protocolConfiguration
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func print(appVersion: String?) {
|
||||
if let appVersion = appVersion {
|
||||
log.info("App version: \(appVersion)")
|
||||
|
@ -337,7 +334,6 @@ extension OpenVPNProvider.Configuration {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public extension UserDefaults {
|
||||
@objc var dataCountArray: [Int]? {
|
||||
get {
|
||||
|
|
|
@ -53,14 +53,12 @@ extension OpenVPNProvider {
|
|||
data = Data([byte])
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public init(_ data: Data) {
|
||||
self.data = data
|
||||
}
|
||||
|
||||
// MARK: Equatable
|
||||
|
||||
/// :nodoc:
|
||||
public static func ==(lhs: Message, rhs: Message) -> Bool {
|
||||
return (lhs.data == rhs.data)
|
||||
}
|
||||
|
|
|
@ -203,7 +203,6 @@ public class OpenVPNSession: Session {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
deinit {
|
||||
cleanup()
|
||||
}
|
||||
|
|
|
@ -40,10 +40,8 @@ import TunnelKitOpenVPNCore
|
|||
import CTunnelKitCore
|
||||
import CTunnelKitOpenVPNProtocol
|
||||
|
||||
/// :nodoc:
|
||||
extension ControlPacket {
|
||||
|
||||
/// :nodoc:
|
||||
open override var description: String {
|
||||
var msg: [String] = ["\(code) | \(key)"]
|
||||
msg.append("sid: \(sessionId.toHex())")
|
||||
|
@ -86,7 +84,6 @@ extension OpenVPN {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension PacketCode: CustomStringConvertible {
|
||||
public var description: String {
|
||||
switch self {
|
||||
|
|
|
@ -60,7 +60,6 @@ extension OpenVPN {
|
|||
|
||||
// MARK: CustomStringConvertible
|
||||
|
||||
/// :nodoc:
|
||||
var description: String {
|
||||
let stripped = NSMutableString(string: original)
|
||||
ConfigurationParser.Regex.authToken.replaceMatches(
|
||||
|
|
|
@ -39,7 +39,6 @@ import Foundation
|
|||
// hex -> Data conversion code from: http://stackoverflow.com/questions/32231926/nsdata-from-hex-string
|
||||
// Data -> hex conversion code from: http://stackoverflow.com/questions/39075043/how-to-convert-data-to-hex-string-in-swift
|
||||
|
||||
/// :nodoc:
|
||||
extension UnicodeScalar {
|
||||
public var hexNibble: UInt8 {
|
||||
let value = self.value
|
||||
|
@ -56,7 +55,6 @@ extension UnicodeScalar {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension Data {
|
||||
public init(hex: String) {
|
||||
let scalars = hex.unicodeScalars
|
||||
|
@ -84,7 +82,6 @@ extension Data {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension Data {
|
||||
public mutating func append(_ value: UInt16) {
|
||||
var localValue = value
|
||||
|
@ -204,28 +201,24 @@ extension Data {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension Data {
|
||||
public func subdata(offset: Int, count: Int) -> Data {
|
||||
return subdata(in: offset..<(offset + count))
|
||||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension Array where Element == Data {
|
||||
public var flatCount: Int {
|
||||
return reduce(0) { $0 + $1.count }
|
||||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension UnsafeRawBufferPointer {
|
||||
public var bytePointer: UnsafePointer<Element> {
|
||||
return bindMemory(to: Element.self).baseAddress!
|
||||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension UnsafeMutableRawBufferPointer {
|
||||
public var bytePointer: UnsafeMutablePointer<Element> {
|
||||
return bindMemory(to: Element.self).baseAddress!
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
/// :nodoc:
|
||||
extension NSRegularExpression {
|
||||
public convenience init(_ pattern: String) {
|
||||
try! self.init(pattern: pattern, options: [])
|
||||
|
|
|
@ -36,20 +36,17 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
/// :nodoc:
|
||||
public extension DispatchQueue {
|
||||
func schedule(after: DispatchTimeInterval, block: @escaping () -> Void) {
|
||||
asyncAfter(deadline: .now() + after, execute: block)
|
||||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func fromDictionary<T: Decodable>(_ type: T.Type, _ dictionary: [String: Any]) throws -> T {
|
||||
let data = try JSONSerialization.data(withJSONObject: dictionary, options: .fragmentsAllowed)
|
||||
return try JSONDecoder().decode(T.self, from: data)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public extension Encodable {
|
||||
func asDictionary() throws -> [String: Any] {
|
||||
let data = try JSONEncoder().encode(self)
|
||||
|
@ -60,7 +57,6 @@ public extension Encodable {
|
|||
}
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
extension TimeInterval {
|
||||
public var asTimeString: String {
|
||||
var ticks = Int(self)
|
||||
|
|
Loading…
Reference in New Issue