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`.
|
/// Disconnects on sleep if `true`.
|
||||||
public var disconnectsOnSleep = false
|
public var disconnectsOnSleep = false
|
||||||
|
|
||||||
|
/// Enables best-effort kill switch.
|
||||||
|
public var killSwitch = false
|
||||||
|
|
||||||
public init() {
|
public init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,6 @@ extension OpenVPN {
|
||||||
/// The client configuration.
|
/// The client configuration.
|
||||||
public let configuration: OpenVPN.Configuration
|
public let configuration: OpenVPN.Configuration
|
||||||
|
|
||||||
/// Enables kill switch.
|
|
||||||
public var killSwitch: Bool?
|
|
||||||
|
|
||||||
/// The optional username.
|
/// The optional username.
|
||||||
public var username: String?
|
public var username: String?
|
||||||
|
|
||||||
|
@ -116,8 +113,8 @@ extension OpenVPN.ProviderConfiguration: NetworkExtensionConfiguration {
|
||||||
}
|
}
|
||||||
protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false
|
protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false
|
||||||
protocolConfiguration.providerConfiguration = try asDictionary()
|
protocolConfiguration.providerConfiguration = try asDictionary()
|
||||||
if #available(iOS 14, *), let killSwitch = killSwitch {
|
if #available(iOS 14, *) {
|
||||||
protocolConfiguration.includeAllNetworks = killSwitch
|
protocolConfiguration.includeAllNetworks = extra?.killSwitch ?? false
|
||||||
}
|
}
|
||||||
return protocolConfiguration
|
return protocolConfiguration
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,6 @@ extension WireGuard {
|
||||||
|
|
||||||
public let configuration: WireGuard.Configuration
|
public let configuration: WireGuard.Configuration
|
||||||
|
|
||||||
public var killSwitch: Bool?
|
|
||||||
|
|
||||||
public var shouldDebug = false
|
public var shouldDebug = false
|
||||||
|
|
||||||
public var debugLogPath: String? = nil
|
public var debugLogPath: String? = nil
|
||||||
|
@ -85,8 +83,8 @@ extension WireGuard.ProviderConfiguration: NetworkExtensionConfiguration {
|
||||||
protocolConfiguration.passwordReference = extra?.passwordReference
|
protocolConfiguration.passwordReference = extra?.passwordReference
|
||||||
protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false
|
protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false
|
||||||
protocolConfiguration.providerConfiguration = try asDictionary()
|
protocolConfiguration.providerConfiguration = try asDictionary()
|
||||||
if #available(iOS 14, *), let killSwitch = killSwitch {
|
if #available(iOS 14, *) {
|
||||||
protocolConfiguration.includeAllNetworks = killSwitch
|
protocolConfiguration.includeAllNetworks = extra?.killSwitch ?? false
|
||||||
}
|
}
|
||||||
return protocolConfiguration
|
return protocolConfiguration
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue