// // ViewController.swift // Privado VPN // // Created by Juraldinio on 2/5/20. // Copyright © 2020 Privado LLC. All rights reserved. // import UIKit class ViewController: UIViewController { private var service: VPNService? override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. self.view.translatesAutoresizingMaskIntoConstraints = false self.view.backgroundColor = .white let ikev2 = UIButton(frame: .init(x: 0, y: 200, width: 200, height: 50)) ikev2.translatesAutoresizingMaskIntoConstraints = false ikev2.setTitleColor(.black, for: .normal) ikev2.setTitle("IKEv2", for: .normal) ikev2.addTarget(self, action: #selector(self.onIKEV2Connect), for: .touchUpInside) self.view.addSubview(ikev2) let ovpn = UIButton(frame: .init(x: 0, y: 400, width: 200, height: 50)) ovpn.translatesAutoresizingMaskIntoConstraints = false ovpn.setTitleColor(.black, for: .normal) ovpn.setTitle("OpenVPN", for: .normal) ovpn.addTarget(self, action: #selector(self.onOpenVPNConnect), for: .touchUpInside) self.view.addSubview(ovpn) } @objc private func onIKEV2Connect() { let configuration = IKEv2Configuration(username: "woodhouse03", password: "privado2020", shared: "", city: "", server: "phx-001.vpn.privado.io", serverIp: "", remoteIdentifier: "vpn.privado.io") self.service = IKEv2Service.create(with: nil) self.service?.connect(using: configuration) } @objc private func onOpenVPNConnect() { #if SIMULATOR #else let configuration = OpenVPNConfiguration(username: "woodhouse03", password: "privado2020", city: "", server: "phx-001.vpn.privado.io", serverIp: "", port: UInt16(1194), socketType: "TCP"/*, cipher: "AES-256-CBC"*/) self.service = OpenVPNService() self.service?.connect(using: configuration) #endif } }