Use keypath in .map occurrences
This commit is contained in:
parent
5913b801a9
commit
fa5aa86399
|
@ -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))"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -112,7 +112,7 @@ extension TunnelConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
let peerPublicKeysArray = peerConfigurations.map { $0.publicKey }
|
||||
let peerPublicKeysArray = peerConfigurations.map(\.publicKey)
|
||||
let peerPublicKeysSet = Set<PublicKey>(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 {
|
||||
|
|
Loading…
Reference in New Issue