diff --git a/Sources/TunnelKitCore/IPv4Settings.swift b/Sources/TunnelKitCore/IPv4Settings.swift index afbdbf1..759915a 100644 --- a/Sources/TunnelKitCore/IPv4Settings.swift +++ b/Sources/TunnelKitCore/IPv4Settings.swift @@ -75,6 +75,6 @@ public struct IPv4Settings: Codable, Equatable, CustomStringConvertible { // MARK: CustomStringConvertible public var description: String { - return "addr \(address.maskedDescription) netmask \(addressMask) gw \(defaultGateway.maskedDescription) routes \(routes.map { $0.maskedDescription })" + return "addr \(address.maskedDescription) netmask \(addressMask) gw \(defaultGateway.maskedDescription) routes \(routes.map(\.maskedDescription))" } } diff --git a/Sources/TunnelKitCore/IPv6Settings.swift b/Sources/TunnelKitCore/IPv6Settings.swift index 09400ba..77dfda6 100644 --- a/Sources/TunnelKitCore/IPv6Settings.swift +++ b/Sources/TunnelKitCore/IPv6Settings.swift @@ -75,6 +75,6 @@ public struct IPv6Settings: Codable, Equatable, CustomStringConvertible { // MARK: CustomStringConvertible public var description: String { - return "addr \(address.maskedDescription)/\(addressPrefixLength) gw \(defaultGateway.maskedDescription) routes \(routes.map { $0.maskedDescription })" + return "addr \(address.maskedDescription)/\(addressPrefixLength) gw \(defaultGateway.maskedDescription) routes \(routes.map(\.maskedDescription))" } } diff --git a/Sources/TunnelKitOpenVPNCore/Configuration.swift b/Sources/TunnelKitOpenVPNCore/Configuration.swift index 9a6e8b6..66d5ffb 100644 --- a/Sources/TunnelKitOpenVPNCore/Configuration.swift +++ b/Sources/TunnelKitOpenVPNCore/Configuration.swift @@ -674,7 +674,7 @@ extension OpenVPN.Configuration { log.info("\tRandomize hostnames: true") } if let routingPolicies = routingPolicies { - log.info("\tGateway: \(routingPolicies.map { $0.rawValue })") + log.info("\tGateway: \(routingPolicies.map(\.rawValue))") } else { log.info("\tGateway: not configured") } diff --git a/Sources/TunnelKitOpenVPNCore/ConfigurationParser.swift b/Sources/TunnelKitOpenVPNCore/ConfigurationParser.swift index 2946b3e..0bb59b5 100644 --- a/Sources/TunnelKitOpenVPNCore/ConfigurationParser.swift +++ b/Sources/TunnelKitOpenVPNCore/ConfigurationParser.swift @@ -378,11 +378,11 @@ extension OpenVPN { optClientKey = CryptoContainer(pem: currentBlock.joined(separator: "\n")) case "tls-auth": - optTLSKeyLines = currentBlock.map { Substring($0) } + optTLSKeyLines = currentBlock.map(Substring.init(_:)) optTLSStrategy = .auth case "tls-crypt": - optTLSKeyLines = currentBlock.map { Substring($0) } + optTLSKeyLines = currentBlock.map(Substring.init(_:)) optTLSStrategy = .crypt default: diff --git a/Sources/TunnelKitOpenVPNProtocol/Authenticator.swift b/Sources/TunnelKitOpenVPNProtocol/Authenticator.swift index 0133a62..ca8cd6e 100644 --- a/Sources/TunnelKitOpenVPNProtocol/Authenticator.swift +++ b/Sources/TunnelKitOpenVPNProtocol/Authenticator.swift @@ -160,7 +160,7 @@ extension OpenVPN { // peer info var extra: [String: String] = [:] if let dataCiphers = options.dataCiphers { - extra["IV_CIPHERS"] = dataCiphers.map { $0.rawValue }.joined(separator: ":") + extra["IV_CIPHERS"] = dataCiphers.map(\.rawValue).joined(separator: ":") } raw.appendSized(Z(CoreConfiguration.OpenVPN.peerInfo(extra: extra), nullTerminated: true)) diff --git a/Sources/TunnelKitWireGuardAppExtension/WireGuardTunnelProvider.swift b/Sources/TunnelKitWireGuardAppExtension/WireGuardTunnelProvider.swift index 038c042..63f17c8 100644 --- a/Sources/TunnelKitWireGuardAppExtension/WireGuardTunnelProvider.swift +++ b/Sources/TunnelKitWireGuardAppExtension/WireGuardTunnelProvider.swift @@ -62,7 +62,7 @@ open class WireGuardTunnelProvider: NEPacketTunnelProvider { completionHandler(WireGuardProviderError.couldNotDetermineFileDescriptor) case .dnsResolution(let dnsErrors): - let hostnamesWithDnsResolutionFailure = dnsErrors.map { $0.address } + let hostnamesWithDnsResolutionFailure = dnsErrors.map(\.address) .joined(separator: ", ") wg_log(.error, message: "DNS resolution failed for the following hostnames: \(hostnamesWithDnsResolutionFailure)") self.cfg._appexSetLastError(.dnsResolutionFailure) diff --git a/Sources/TunnelKitWireGuardCore/Internal/TunnelConfiguration+WgQuickConfig.swift b/Sources/TunnelKitWireGuardCore/Internal/TunnelConfiguration+WgQuickConfig.swift index 72b6e36..b20dc65 100644 --- a/Sources/TunnelKitWireGuardCore/Internal/TunnelConfiguration+WgQuickConfig.swift +++ b/Sources/TunnelKitWireGuardCore/Internal/TunnelConfiguration+WgQuickConfig.swift @@ -112,7 +112,7 @@ extension TunnelConfiguration { } } - let peerPublicKeysArray = peerConfigurations.map { $0.publicKey } + let peerPublicKeysArray = peerConfigurations.map(\.publicKey) let peerPublicKeysSet = Set(peerPublicKeysArray) if peerPublicKeysArray.count != peerPublicKeysSet.count { throw ParseError.multiplePeersWithSamePublicKey @@ -132,11 +132,11 @@ extension TunnelConfiguration { output.append("ListenPort = \(listenPort)\n") } if !interface.addresses.isEmpty { - let addressString = interface.addresses.map { $0.stringRepresentation }.joined(separator: ", ") + let addressString = interface.addresses.map(\.stringRepresentation).joined(separator: ", ") output.append("Address = \(addressString)\n") } if !interface.dns.isEmpty || !interface.dnsSearch.isEmpty { - var dnsLine = interface.dns.map { $0.stringRepresentation } + var dnsLine = interface.dns.map(\.stringRepresentation) dnsLine.append(contentsOf: interface.dnsSearch) let dnsString = dnsLine.joined(separator: ", ") output.append("DNS = \(dnsString)\n") @@ -152,7 +152,7 @@ extension TunnelConfiguration { output.append("PresharedKey = \(preSharedKey)\n") } if !peer.allowedIPs.isEmpty { - let allowedIPsString = peer.allowedIPs.map { $0.stringRepresentation }.joined(separator: ", ") + let allowedIPsString = peer.allowedIPs.map(\.stringRepresentation).joined(separator: ", ") output.append("AllowedIPs = \(allowedIPsString)\n") } if let endpoint = peer.endpoint {