Set includeAllNetworks for best-effort kill switch (#300)
* Update CHANGELOG * Make kill switch an option
This commit is contained in:
parent
a3b85430fd
commit
0d21731e12
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
- OpenVPN: Support for `--route-nopull`. [#280](https://github.com/passepartoutvpn/tunnelkit/pull/280)
|
- OpenVPN: Support for `--route-nopull`. [#280](https://github.com/passepartoutvpn/tunnelkit/pull/280)
|
||||||
- OpenVPN: Support for `--remote-random-hostname`. [#286](https://github.com/passepartoutvpn/tunnelkit/pull/286)
|
- OpenVPN: Support for `--remote-random-hostname`. [#286](https://github.com/passepartoutvpn/tunnelkit/pull/286)
|
||||||
|
- Use .includeAllNetworks for best-effort kill switch. [#300](https://github.com/passepartoutvpn/tunnelkit/pull/300)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,9 @@ 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?
|
||||||
|
|
||||||
|
@ -95,7 +98,7 @@ extension OpenVPN {
|
||||||
|
|
||||||
extension OpenVPN.ProviderConfiguration: NetworkExtensionConfiguration {
|
extension OpenVPN.ProviderConfiguration: NetworkExtensionConfiguration {
|
||||||
|
|
||||||
public func asTunnelProtocol(
|
public func asTunnelProtocol(
|
||||||
withBundleIdentifier tunnelBundleIdentifier: String,
|
withBundleIdentifier tunnelBundleIdentifier: String,
|
||||||
extra: NetworkExtensionExtra?
|
extra: NetworkExtensionExtra?
|
||||||
) throws -> NETunnelProviderProtocol {
|
) throws -> NETunnelProviderProtocol {
|
||||||
|
@ -112,6 +115,9 @@ 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 {
|
||||||
|
protocolConfiguration.includeAllNetworks = killSwitch
|
||||||
|
}
|
||||||
return protocolConfiguration
|
return protocolConfiguration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,8 @@ 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
|
||||||
|
@ -73,7 +75,7 @@ extension WireGuard {
|
||||||
|
|
||||||
extension WireGuard.ProviderConfiguration: NetworkExtensionConfiguration {
|
extension WireGuard.ProviderConfiguration: NetworkExtensionConfiguration {
|
||||||
|
|
||||||
public func asTunnelProtocol(
|
public func asTunnelProtocol(
|
||||||
withBundleIdentifier tunnelBundleIdentifier: String,
|
withBundleIdentifier tunnelBundleIdentifier: String,
|
||||||
extra: NetworkExtensionExtra?
|
extra: NetworkExtensionExtra?
|
||||||
) throws -> NETunnelProviderProtocol {
|
) throws -> NETunnelProviderProtocol {
|
||||||
|
@ -83,6 +85,9 @@ 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 {
|
||||||
|
protocolConfiguration.includeAllNetworks = killSwitch
|
||||||
|
}
|
||||||
return protocolConfiguration
|
return protocolConfiguration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue