Set includeAllNetworks for best-effort kill switch (#300)

* Update CHANGELOG

* Make kill switch an option
This commit is contained in:
Davide De Rosa 2022-10-30 09:07:17 +01:00 committed by GitHub
parent a3b85430fd
commit 0d21731e12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -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 `--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

View File

@ -59,6 +59,9 @@ extension OpenVPN {
/// The client configuration.
public let configuration: OpenVPN.Configuration
/// Enables kill switch.
public var killSwitch: Bool?
/// The optional username.
public var username: String?
@ -112,6 +115,9 @@ extension OpenVPN.ProviderConfiguration: NetworkExtensionConfiguration {
}
protocolConfiguration.disconnectOnSleep = extra?.disconnectsOnSleep ?? false
protocolConfiguration.providerConfiguration = try asDictionary()
if #available(iOS 14, *), let killSwitch = killSwitch {
protocolConfiguration.includeAllNetworks = killSwitch
}
return protocolConfiguration
}
}

View File

@ -49,6 +49,8 @@ extension WireGuard {
public let configuration: WireGuard.Configuration
public var killSwitch: Bool?
public var shouldDebug = false
public var debugLogPath: String? = nil
@ -83,6 +85,9 @@ 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
}
return protocolConfiguration
}
}