Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vpnManager.loadFromPreferences { (error) in
- if error == nil {
- self.ipSecProtcol.serverAddress = "address"
- self.ipSecProtcol.authenticationMethod = NEVPNIKEAuthenticationMethod.certificate
- self.ipSecProtcol.identityData = NSData(contentsOfFile: Bundle.main.path(forResource: "client", ofType: "p12")!) as? Data
- self.ipSecProtcol.username = "username"
- self.ipSecProtcol.passwordReference = KeychainWrapper.getData("password")
- self.ipSecProtcol.identityDataPassword = "password"
- self.ipSecProtcol.useExtendedAuthentication = false
- self.ipSecProtcol.disconnectOnSleep = false
- self.vpnManager.protocolConfiguration = self.ipSecProtcol
- self.vpnManager.isOnDemandEnabled = false
- self.vpnManager.isEnabled = true
- self.vpnManager.saveToPreferences { (savingError) in
- if savingError == nil {
- do {
- try self.vpnManager.connection.startVPNTunnel()
- }
- catch {
- print(error.localizedDescription)
- }
- }else {
- print(savingError?.localizedDescription)
- }
- }
- } else {
- print(error?.localizedDescription)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement