Move kill switch to configuration extras
This commit is contained in:
parent
48af81e414
commit
47281cafc9
|
@ -38,6 +38,9 @@ public struct NetworkExtensionExtra {
|
|||
/// Disconnects on sleep if `true`.
|
||||
public var disconnectsOnSleep = false
|
||||
|
||||
/// Enables best-effort kill switch.
|
||||
public var killSwitch = false
|
||||
|
||||
public init() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,9 +59,6 @@ extension OpenVPN {
|
|||
/// The client configuration.
|
||||
public let configuration: OpenVPN.Configuration
|
||||
|
||||
/// Enables kill switch.
|
||||
public var killSwitch: Bool?
|
||||
|
||||
/// The optional username.
|
||||
public var username: String?
|
||||
|
||||
|
@ -116,8 +113,8 @@ extension OpenVPN.ProviderConfiguration: NetworkExtensionConfiguration {
|
|||
}
|
||||
protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false
|
||||
protocolConfiguration.providerConfiguration = try asDictionary()
|
||||
if #available(iOS 14, *), let killSwitch = killSwitch {
|
||||
protocolConfiguration.includeAllNetworks = killSwitch
|
||||
if #available(iOS 14, *) {
|
||||
protocolConfiguration.includeAllNetworks = extra?.killSwitch ?? false
|
||||
}
|
||||
return protocolConfiguration
|
||||
}
|
||||
|
|
|
@ -49,8 +49,6 @@ extension WireGuard {
|
|||
|
||||
public let configuration: WireGuard.Configuration
|
||||
|
||||
public var killSwitch: Bool?
|
||||
|
||||
public var shouldDebug = false
|
||||
|
||||
public var debugLogPath: String? = nil
|
||||
|
@ -85,8 +83,8 @@ extension WireGuard.ProviderConfiguration: NetworkExtensionConfiguration {
|
|||
protocolConfiguration.passwordReference = extra?.passwordReference
|
||||
protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false
|
||||
protocolConfiguration.providerConfiguration = try asDictionary()
|
||||
if #available(iOS 14, *), let killSwitch = killSwitch {
|
||||
protocolConfiguration.includeAllNetworks = killSwitch
|
||||
if #available(iOS 14, *) {
|
||||
protocolConfiguration.includeAllNetworks = extra?.killSwitch ?? false
|
||||
}
|
||||
return protocolConfiguration
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue