daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Dec 6th, 2016 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import NetworkExtension
  2.  
  3. override func viewDidLoad() {
  4.     //connect to vpn first
  5.     let manager = NEVPNManager.shared()
  6.     manager.loadFromPreferences { (error) -> Void in
  7.         if manager.protocolConfiguration  == nil {
  8.             let newIPSec = NEVPNProtocolIKEv2()
  9.             newIPSec.serverAddress = "mycompany.vpn"
  10.             newIPSec.username = "myvpnusername"
  11.             newIPSec.identityDataPassword = "myvpnpassword"
  12.             newIPSec.authenticationMethod = NEVPNIKEAuthenticationMethod.none
  13.             newIPSec.disconnectOnSleep = false
  14.  
  15.             manager.protocolConfiguration = newIPSec
  16.             manager.isEnabled = true
  17.  
  18.             manager.saveToPreferences(completionHandler: { (error) -> Void in
  19.  
  20.             })
  21.         }
  22.     }
  23.     //
  24.  
  25.     super.viewDidLoad()
  26.     // Do any additional setup after loading the view, typically from a nib.
  27.  
  28.     let url = NSURL(string: "http://websitefromLocalhostOfMywork.php")
  29.     let request = NSURLRequest(url:url! as URL)
  30.     webview.loadRequest(request as URLRequest)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top