Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Switch VPN protocol to IKEv2

  • Loading branch information
naira-cliqz authored and mahmoud-adam85 committed Feb 14, 2019
1 parent 1bea7ae commit cbdfedd132a36df52b031febb29be55a00f9cfa8
Showing with 415 additions and 28 deletions.
  1. +13 −2 Cliqz/HomePanel/VPN/VPNViewController.swift
  2. +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

0 comments on commit cbdfedd

Please sign in to comment.