Add method to rename immutable profile
This commit is contained in:
parent
3f1e98f8ac
commit
aa2b6bafaf
|
@ -43,6 +43,8 @@ protocol ConnectionProfile: class, EndpointDataSource {
|
||||||
var requiresCredentials: Bool { get }
|
var requiresCredentials: Bool { get }
|
||||||
|
|
||||||
func generate(from configuration: TunnelKitProvider.Configuration, preferences: Preferences) throws -> TunnelKitProvider.Configuration
|
func generate(from configuration: TunnelKitProvider.Configuration, preferences: Preferences) throws -> TunnelKitProvider.Configuration
|
||||||
|
|
||||||
|
func with(newId: String) -> ConnectionProfile
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ConnectionProfile {
|
extension ConnectionProfile {
|
||||||
|
|
|
@ -489,7 +489,7 @@ private class PlaceholderConnectionProfile: ConnectionProfile {
|
||||||
|
|
||||||
let id: String
|
let id: String
|
||||||
|
|
||||||
var username: String?
|
var username: String? = nil
|
||||||
|
|
||||||
var requiresCredentials: Bool = false
|
var requiresCredentials: Bool = false
|
||||||
|
|
||||||
|
@ -497,6 +497,10 @@ private class PlaceholderConnectionProfile: ConnectionProfile {
|
||||||
fatalError("Generating configuration from a PlaceholderConnectionProfile")
|
fatalError("Generating configuration from a PlaceholderConnectionProfile")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func with(newId: String) -> ConnectionProfile {
|
||||||
|
return PlaceholderConnectionProfile(ConnectionService.ProfileKey(context, newId))
|
||||||
|
}
|
||||||
|
|
||||||
var mainAddress: String = ""
|
var mainAddress: String = ""
|
||||||
|
|
||||||
var addresses: [String] = []
|
var addresses: [String] = []
|
||||||
|
|
|
@ -65,6 +65,13 @@ class HostConnectionProfile: ConnectionProfile, Codable, Equatable {
|
||||||
|
|
||||||
return builder.build()
|
return builder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func with(newId: String) -> ConnectionProfile {
|
||||||
|
let profile = HostConnectionProfile(title: newId, hostname: hostname)
|
||||||
|
profile.username = username
|
||||||
|
profile.parameters = parameters
|
||||||
|
return profile
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension HostConnectionProfile {
|
extension HostConnectionProfile {
|
||||||
|
|
|
@ -139,6 +139,10 @@ class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
|
||||||
}
|
}
|
||||||
return builder.build()
|
return builder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func with(newId: String) -> ConnectionProfile {
|
||||||
|
fatalError("Cannot rename a ProviderConnectionProfile")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProviderConnectionProfile {
|
extension ProviderConnectionProfile {
|
||||||
|
|
Loading…
Reference in New Issue