Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement