Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Switch VPN protocol to IKEv2
- Loading branch information
Showing
with
415 additions
and
28 deletions.
-
+13
−2
Cliqz/HomePanel/VPN/VPNViewController.swift
-
+402
−26
package-lock.json
|
|
@@ -133,6 +133,17 @@ class VPN { |
|
|
|
|
|
NEVPNManager.shared().loadFromPreferences { (error) in |
|
|
if NEVPNManager.shared().protocolConfiguration == nil || NEVPNManager.shared().protocolConfiguration?.serverAddress != country.endpoint { |
|
|
|
|
|
let a = NEVPNProtocolIKEv2() |
|
|
a.useExtendedAuthentication = true |
|
|
a.authenticationMethod = .sharedSecret |
|
|
a.sharedSecretReference = creds.sharedSecret |
|
|
a.username = creds.username |
|
|
a.passwordReference = creds.password |
|
|
a.serverAddress = country.endpoint |
|
|
a.disconnectOnSleep = false |
|
|
|
|
|
|
|
|
let newIPSec = NEVPNProtocolIPSec() |
|
|
//setUp the protocol |
|
|
newIPSec.useExtendedAuthentication = true |
|
|
@@ -142,15 +153,15 @@ class VPN { |
|
|
|
|
|
newIPSec.username = creds.username |
|
|
newIPSec.passwordReference = creds.password |
|
|
newIPSec.serverAddress = country.endpoint; |
|
|
newIPSec.serverAddress = country.endpoint |
|
|
newIPSec.disconnectOnSleep = false |
|
|
|
|
|
//Need to figure out how to do this properly. If we do it like this it will say that the configuration is invalid. |
|
|
// let alwaysConnected = NEOnDemandRule() |
|
|
// alwaysConnected.interfaceTypeMatch = .any |
|
|
// NEVPNManager.shared().onDemandRules = [alwaysConnected] |
|
|
|
|
|
NEVPNManager.shared().protocolConfiguration = newIPSec |
|
|
NEVPNManager.shared().protocolConfiguration = a |
|
|
NEVPNManager.shared().isOnDemandEnabled = true |
|
|
NEVPNManager.shared().isEnabled = true |
|
|
|
|
|
|
Oops, something went wrong.