Move name from interface to tunnel

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld
2018-12-22 00:28:18 +01:00
parent 9295895e3a
commit 4ed646973e
13 changed files with 41 additions and 35 deletions
@@ -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)
}
}