From 4ed646973ee4e1871cda792083bf4fe70afa8c3f Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 22 Dec 2018 00:28:18 +0100 Subject: Move name from interface to tunnel Signed-off-by: Jason A. Donenfeld --- WireGuard/Shared/NETunnelProviderProtocol+Extension.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'WireGuard/Shared/NETunnelProviderProtocol+Extension.swift') diff --git a/WireGuard/Shared/NETunnelProviderProtocol+Extension.swift b/WireGuard/Shared/NETunnelProviderProtocol+Extension.swift index 2f6ea1f..258c968 100644 --- a/WireGuard/Shared/NETunnelProviderProtocol+Extension.swift +++ b/WireGuard/Shared/NETunnelProviderProtocol+Extension.swift @@ -27,13 +27,14 @@ extension NETunnelProviderProtocol { serverAddress = "Multiple endpoints" } - username = tunnelConfiguration.interface.name + //TODO(roopc): Why are we doing this? Just for kicks? Is it useful? Seems needless. + username = tunnelConfiguration.name } - func tunnelConfiguration(name: String?) -> TunnelConfiguration? { + func asTunnelConfiguration(called name: String? = nil) -> TunnelConfiguration? { migrateConfigurationIfNeeded() guard let serializedConfig = providerConfiguration?[Keys.wgQuickConfig.rawValue] as? String else { return nil } - return try? TunnelConfiguration(serializedConfig, name: name) + return try? TunnelConfiguration(fromWgQuickConfig: serializedConfig, called: name) } } -- cgit v1.2.3-59-g8ed1b