From 9e14f332357edc5ae494414aad4609c8ed40659a Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Thu, 11 Nov 2021 21:42:10 +0100 Subject: [PATCH] Drop jazzy, will use DocC --- .jazzy.yaml | 61 ------------------- .../MemoryDestination.swift | 3 - .../Transport/NETCPSocket.swift | 12 ---- .../Transport/NETunnelInterface.swift | 5 -- .../Transport/NEUDPSocket.swift | 12 ---- .../NWTCPConnectionState+Description.swift | 1 - .../NWUDPSessionState+Description.swift | 1 - Sources/TunnelKitCore/CoreConfiguration.swift | 1 - Sources/TunnelKitCore/DNSResolver.swift | 1 - Sources/TunnelKitCore/EndpointProtocol.swift | 6 -- Sources/TunnelKitCore/IPv4Settings.swift | 4 -- Sources/TunnelKitCore/IPv6Settings.swift | 4 -- Sources/TunnelKitCore/Proxy.swift | 4 -- Sources/TunnelKitCore/SecureRandom.swift | 2 - Sources/TunnelKitIKE/NativeProvider.swift | 1 - .../TunnelKitManager/MockVPNProvider.swift | 1 - .../NetworkExtensionLocator.swift | 1 - .../NetworkExtensionVPNConfiguration.swift | 2 - .../NETCPLink.swift | 1 - .../NEUDPLink.swift | 1 - .../OpenVPNTunnelProvider.swift | 12 ---- .../CompressionAlgorithm.swift | 2 - .../CompressionFraming.swift | 2 - .../TunnelKitOpenVPNCore/Configuration.swift | 13 ---- .../ConfigurationParser.swift | 1 - .../CryptoContainer.swift | 4 -- Sources/TunnelKitOpenVPNCore/StaticKey.swift | 6 -- Sources/TunnelKitOpenVPNCore/TLSWrap.swift | 3 - .../OpenVPNProvider+Configuration.swift | 4 -- .../OpenVPNProvider+Interaction.swift | 2 - .../OpenVPNSession.swift | 1 - Sources/TunnelKitOpenVPNProtocol/Packet.swift | 3 - .../TunnelKitOpenVPNProtocol/PushReply.swift | 1 - .../__TunnelKitUtils/Data+Manipulation.swift | 7 --- .../NSRegularExpression+Shortcuts.swift | 1 - Sources/__TunnelKitUtils/Utils.swift | 4 -- 36 files changed, 190 deletions(-) delete mode 100644 .jazzy.yaml diff --git a/.jazzy.yaml b/.jazzy.yaml deleted file mode 100644 index d898e0d..0000000 --- a/.jazzy.yaml +++ /dev/null @@ -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 diff --git a/Sources/TunnelKitAppExtension/MemoryDestination.swift b/Sources/TunnelKitAppExtension/MemoryDestination.swift index 5e00f4a..234ac09 100644 --- a/Sources/TunnelKitAppExtension/MemoryDestination.swift +++ b/Sources/TunnelKitAppExtension/MemoryDestination.swift @@ -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") diff --git a/Sources/TunnelKitAppExtension/Transport/NETCPSocket.swift b/Sources/TunnelKitAppExtension/Transport/NETCPSocket.swift index 2548968..46d91cf 100644 --- a/Sources/TunnelKitAppExtension/Transport/NETCPSocket.swift +++ b/Sources/TunnelKitAppExtension/Transport/NETCPSocket.swift @@ -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 { diff --git a/Sources/TunnelKitAppExtension/Transport/NETunnelInterface.swift b/Sources/TunnelKitAppExtension/Transport/NETunnelInterface.swift index 8d54fcb..20e82d4 100644 --- a/Sources/TunnelKitAppExtension/Transport/NETunnelInterface.swift +++ b/Sources/TunnelKitAppExtension/Transport/NETunnelInterface.swift @@ -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) diff --git a/Sources/TunnelKitAppExtension/Transport/NEUDPSocket.swift b/Sources/TunnelKitAppExtension/Transport/NEUDPSocket.swift index 429baf3..b7fa884 100644 --- a/Sources/TunnelKitAppExtension/Transport/NEUDPSocket.swift +++ b/Sources/TunnelKitAppExtension/Transport/NEUDPSocket.swift @@ -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 { diff --git a/Sources/TunnelKitAppExtension/Transport/NWTCPConnectionState+Description.swift b/Sources/TunnelKitAppExtension/Transport/NWTCPConnectionState+Description.swift index 02adcd6..1be381a 100644 --- a/Sources/TunnelKitAppExtension/Transport/NWTCPConnectionState+Description.swift +++ b/Sources/TunnelKitAppExtension/Transport/NWTCPConnectionState+Description.swift @@ -37,7 +37,6 @@ import Foundation import NetworkExtension -/// :nodoc: extension NWTCPConnectionState: CustomStringConvertible { public var description: String { switch self { diff --git a/Sources/TunnelKitAppExtension/Transport/NWUDPSessionState+Description.swift b/Sources/TunnelKitAppExtension/Transport/NWUDPSessionState+Description.swift index f90a819..42400b7 100644 --- a/Sources/TunnelKitAppExtension/Transport/NWUDPSessionState+Description.swift +++ b/Sources/TunnelKitAppExtension/Transport/NWUDPSessionState+Description.swift @@ -37,7 +37,6 @@ import Foundation import NetworkExtension -/// :nodoc: extension NWUDPSessionState: CustomStringConvertible { public var description: String { switch self { diff --git a/Sources/TunnelKitCore/CoreConfiguration.swift b/Sources/TunnelKitCore/CoreConfiguration.swift index f2f81db..8581d22 100644 --- a/Sources/TunnelKitCore/CoreConfiguration.swift +++ b/Sources/TunnelKitCore/CoreConfiguration.swift @@ -36,7 +36,6 @@ import Foundation -/// :nodoc: public class CoreConfiguration { public static let identifier = "com.algoritmico.TunnelKit" diff --git a/Sources/TunnelKitCore/DNSResolver.swift b/Sources/TunnelKitCore/DNSResolver.swift index 9a88506..68f16aa 100644 --- a/Sources/TunnelKitCore/DNSResolver.swift +++ b/Sources/TunnelKitCore/DNSResolver.swift @@ -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 diff --git a/Sources/TunnelKitCore/EndpointProtocol.swift b/Sources/TunnelKitCore/EndpointProtocol.swift index 5ca1095..91fffb8 100644 --- a/Sources/TunnelKitCore/EndpointProtocol.swift +++ b/Sources/TunnelKitCore/EndpointProtocol.swift @@ -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() diff --git a/Sources/TunnelKitCore/IPv4Settings.swift b/Sources/TunnelKitCore/IPv4Settings.swift index 0c5fb58..f76ca77 100644 --- a/Sources/TunnelKitCore/IPv4Settings.swift +++ b/Sources/TunnelKitCore/IPv4Settings.swift @@ -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 })" } diff --git a/Sources/TunnelKitCore/IPv6Settings.swift b/Sources/TunnelKitCore/IPv6Settings.swift index c3fbac1..0e531fb 100644 --- a/Sources/TunnelKitCore/IPv6Settings.swift +++ b/Sources/TunnelKitCore/IPv6Settings.swift @@ -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 })" } diff --git a/Sources/TunnelKitCore/Proxy.swift b/Sources/TunnelKitCore/Proxy.swift index a4bc1e1..31ab6a4 100644 --- a/Sources/TunnelKitCore/Proxy.swift +++ b/Sources/TunnelKitCore/Proxy.swift @@ -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 } diff --git a/Sources/TunnelKitCore/SecureRandom.swift b/Sources/TunnelKitCore/SecureRandom.swift index 049fd8b..87bd140 100644 --- a/Sources/TunnelKitCore/SecureRandom.swift +++ b/Sources/TunnelKitCore/SecureRandom.swift @@ -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 { diff --git a/Sources/TunnelKitIKE/NativeProvider.swift b/Sources/TunnelKitIKE/NativeProvider.swift index 6d12ad3..0668ec7 100644 --- a/Sources/TunnelKitIKE/NativeProvider.swift +++ b/Sources/TunnelKitIKE/NativeProvider.swift @@ -30,7 +30,6 @@ import TunnelKitManager public class NativeProvider: VPNProvider { private let provider: NetworkExtensionVPNProvider - /// :nodoc: public init() { provider = NetworkExtensionVPNProvider(locator: NetworkExtensionNativeLocator()) } diff --git a/Sources/TunnelKitManager/MockVPNProvider.swift b/Sources/TunnelKitManager/MockVPNProvider.swift index aa52c46..ae13592 100644 --- a/Sources/TunnelKitManager/MockVPNProvider.swift +++ b/Sources/TunnelKitManager/MockVPNProvider.swift @@ -28,7 +28,6 @@ import Foundation /// Simulates a VPN provider. public class MockVPNProvider: VPNProvider, VPNProviderIPC { - /// :nodoc: public init() { } diff --git a/Sources/TunnelKitManager/NetworkExtensionLocator.swift b/Sources/TunnelKitManager/NetworkExtensionLocator.swift index b866d09..7b08786 100644 --- a/Sources/TunnelKitManager/NetworkExtensionLocator.swift +++ b/Sources/TunnelKitManager/NetworkExtensionLocator.swift @@ -40,7 +40,6 @@ public protocol NetworkExtensionLocator { /// Locator for native VPN protocols. public class NetworkExtensionNativeLocator: NetworkExtensionLocator { - /// :nodoc: public init() { } diff --git a/Sources/TunnelKitManager/NetworkExtensionVPNConfiguration.swift b/Sources/TunnelKitManager/NetworkExtensionVPNConfiguration.swift index a75b809..41438f6 100644 --- a/Sources/TunnelKitManager/NetworkExtensionVPNConfiguration.swift +++ b/Sources/TunnelKitManager/NetworkExtensionVPNConfiguration.swift @@ -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 diff --git a/Sources/TunnelKitOpenVPNAppExtension/NETCPLink.swift b/Sources/TunnelKitOpenVPNAppExtension/NETCPLink.swift index aa5c794..4833179 100644 --- a/Sources/TunnelKitOpenVPNAppExtension/NETCPLink.swift +++ b/Sources/TunnelKitOpenVPNAppExtension/NETCPLink.swift @@ -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) diff --git a/Sources/TunnelKitOpenVPNAppExtension/NEUDPLink.swift b/Sources/TunnelKitOpenVPNAppExtension/NEUDPLink.swift index 18a13d1..2302398 100644 --- a/Sources/TunnelKitOpenVPNAppExtension/NEUDPLink.swift +++ b/Sources/TunnelKitOpenVPNAppExtension/NEUDPLink.swift @@ -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) diff --git a/Sources/TunnelKitOpenVPNAppExtension/OpenVPNTunnelProvider.swift b/Sources/TunnelKitOpenVPNAppExtension/OpenVPNTunnelProvider.swift index 177c6b8..e53086f 100644 --- a/Sources/TunnelKitOpenVPNAppExtension/OpenVPNTunnelProvider.swift +++ b/Sources/TunnelKitOpenVPNAppExtension/OpenVPNTunnelProvider.swift @@ -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)") diff --git a/Sources/TunnelKitOpenVPNCore/CompressionAlgorithm.swift b/Sources/TunnelKitOpenVPNCore/CompressionAlgorithm.swift index 87aeb5b..27a9a4f 100644 --- a/Sources/TunnelKitOpenVPNCore/CompressionAlgorithm.swift +++ b/Sources/TunnelKitOpenVPNCore/CompressionAlgorithm.swift @@ -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: diff --git a/Sources/TunnelKitOpenVPNCore/CompressionFraming.swift b/Sources/TunnelKitOpenVPNCore/CompressionFraming.swift index f0eab6e..da1ad3e 100644 --- a/Sources/TunnelKitOpenVPNCore/CompressionFraming.swift +++ b/Sources/TunnelKitOpenVPNCore/CompressionFraming.swift @@ -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: diff --git a/Sources/TunnelKitOpenVPNCore/Configuration.swift b/Sources/TunnelKitOpenVPNCore/Configuration.swift index bab1ddf..2b3f76a 100644 --- a/Sources/TunnelKitOpenVPNCore/Configuration.swift +++ b/Sources/TunnelKitOpenVPNCore/Configuration.swift @@ -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") diff --git a/Sources/TunnelKitOpenVPNCore/ConfigurationParser.swift b/Sources/TunnelKitOpenVPNCore/ConfigurationParser.swift index b14046b..c7a2581 100644 --- a/Sources/TunnelKitOpenVPNCore/ConfigurationParser.swift +++ b/Sources/TunnelKitOpenVPNCore/ConfigurationParser.swift @@ -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]+") diff --git a/Sources/TunnelKitOpenVPNCore/CryptoContainer.swift b/Sources/TunnelKitOpenVPNCore/CryptoContainer.swift index 0760430..60d5f59 100644 --- a/Sources/TunnelKitOpenVPNCore/CryptoContainer.swift +++ b/Sources/TunnelKitOpenVPNCore/CryptoContainer.swift @@ -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) diff --git a/Sources/TunnelKitOpenVPNCore/StaticKey.swift b/Sources/TunnelKitOpenVPNCore/StaticKey.swift index 3e5e863..aa6c05e 100644 --- a/Sources/TunnelKitOpenVPNCore/StaticKey.swift +++ b/Sources/TunnelKitOpenVPNCore/StaticKey.swift @@ -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) diff --git a/Sources/TunnelKitOpenVPNCore/TLSWrap.swift b/Sources/TunnelKitOpenVPNCore/TLSWrap.swift index 0c3c2ef..20a89cf 100644 --- a/Sources/TunnelKitOpenVPNCore/TLSWrap.swift +++ b/Sources/TunnelKitOpenVPNCore/TLSWrap.swift @@ -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) } diff --git a/Sources/TunnelKitOpenVPNManager/OpenVPNProvider+Configuration.swift b/Sources/TunnelKitOpenVPNManager/OpenVPNProvider+Configuration.swift index 95857c1..c82f462 100644 --- a/Sources/TunnelKitOpenVPNManager/OpenVPNProvider+Configuration.swift +++ b/Sources/TunnelKitOpenVPNManager/OpenVPNProvider+Configuration.swift @@ -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 { diff --git a/Sources/TunnelKitOpenVPNManager/OpenVPNProvider+Interaction.swift b/Sources/TunnelKitOpenVPNManager/OpenVPNProvider+Interaction.swift index 4347a27..b52f93e 100644 --- a/Sources/TunnelKitOpenVPNManager/OpenVPNProvider+Interaction.swift +++ b/Sources/TunnelKitOpenVPNManager/OpenVPNProvider+Interaction.swift @@ -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) } diff --git a/Sources/TunnelKitOpenVPNProtocol/OpenVPNSession.swift b/Sources/TunnelKitOpenVPNProtocol/OpenVPNSession.swift index a751862..3d30fa2 100644 --- a/Sources/TunnelKitOpenVPNProtocol/OpenVPNSession.swift +++ b/Sources/TunnelKitOpenVPNProtocol/OpenVPNSession.swift @@ -203,7 +203,6 @@ public class OpenVPNSession: Session { } } - /// :nodoc: deinit { cleanup() } diff --git a/Sources/TunnelKitOpenVPNProtocol/Packet.swift b/Sources/TunnelKitOpenVPNProtocol/Packet.swift index 27d86bf..5af67d6 100644 --- a/Sources/TunnelKitOpenVPNProtocol/Packet.swift +++ b/Sources/TunnelKitOpenVPNProtocol/Packet.swift @@ -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 { diff --git a/Sources/TunnelKitOpenVPNProtocol/PushReply.swift b/Sources/TunnelKitOpenVPNProtocol/PushReply.swift index 494c63d..0a63209 100644 --- a/Sources/TunnelKitOpenVPNProtocol/PushReply.swift +++ b/Sources/TunnelKitOpenVPNProtocol/PushReply.swift @@ -60,7 +60,6 @@ extension OpenVPN { // MARK: CustomStringConvertible - /// :nodoc: var description: String { let stripped = NSMutableString(string: original) ConfigurationParser.Regex.authToken.replaceMatches( diff --git a/Sources/__TunnelKitUtils/Data+Manipulation.swift b/Sources/__TunnelKitUtils/Data+Manipulation.swift index 81eb47e..b0a75fd 100644 --- a/Sources/__TunnelKitUtils/Data+Manipulation.swift +++ b/Sources/__TunnelKitUtils/Data+Manipulation.swift @@ -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 { return bindMemory(to: Element.self).baseAddress! } } -/// :nodoc: extension UnsafeMutableRawBufferPointer { public var bytePointer: UnsafeMutablePointer { return bindMemory(to: Element.self).baseAddress! diff --git a/Sources/__TunnelKitUtils/NSRegularExpression+Shortcuts.swift b/Sources/__TunnelKitUtils/NSRegularExpression+Shortcuts.swift index f00ce68..f95f2b8 100644 --- a/Sources/__TunnelKitUtils/NSRegularExpression+Shortcuts.swift +++ b/Sources/__TunnelKitUtils/NSRegularExpression+Shortcuts.swift @@ -25,7 +25,6 @@ import Foundation -/// :nodoc: extension NSRegularExpression { public convenience init(_ pattern: String) { try! self.init(pattern: pattern, options: []) diff --git a/Sources/__TunnelKitUtils/Utils.swift b/Sources/__TunnelKitUtils/Utils.swift index 0fcd985..5d14615 100644 --- a/Sources/__TunnelKitUtils/Utils.swift +++ b/Sources/__TunnelKitUtils/Utils.swift @@ -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(_ 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)