Nuke trailing spaces
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
@@ -6,18 +6,18 @@ import NetworkExtension
|
||||
private var tunnelNameKey: Void?
|
||||
|
||||
extension NETunnelProviderProtocol {
|
||||
|
||||
|
||||
enum Keys: String {
|
||||
case wgQuickConfig = "WgQuickConfig"
|
||||
}
|
||||
|
||||
|
||||
convenience init?(tunnelConfiguration: TunnelConfiguration) {
|
||||
self.init()
|
||||
|
||||
|
||||
let appId = Bundle.main.bundleIdentifier!
|
||||
providerBundleIdentifier = "\(appId).network-extension"
|
||||
providerConfiguration = [Keys.wgQuickConfig.rawValue: tunnelConfiguration.asWgQuickConfig()]
|
||||
|
||||
|
||||
let endpoints = tunnelConfiguration.peers.compactMap { $0.endpoint }
|
||||
if endpoints.count == 1 {
|
||||
serverAddress = endpoints[0].stringRepresentation
|
||||
@@ -26,14 +26,14 @@ extension NETunnelProviderProtocol {
|
||||
} else {
|
||||
serverAddress = "Multiple endpoints"
|
||||
}
|
||||
|
||||
|
||||
username = tunnelConfiguration.interface.name
|
||||
}
|
||||
|
||||
|
||||
func tunnelConfiguration(name: String?) -> TunnelConfiguration? {
|
||||
migrateConfigurationIfNeeded()
|
||||
guard let serializedConfig = providerConfiguration?[Keys.wgQuickConfig.rawValue] as? String else { return nil }
|
||||
return try? TunnelConfiguration(serializedConfig, name: name)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user