Update Demo

This commit is contained in:
Davide De Rosa 2019-05-23 23:25:35 +02:00
parent be1081aad6
commit adcae1686e
5 changed files with 19 additions and 17 deletions

View File

@ -39,7 +39,7 @@ import UIKit
import NetworkExtension import NetworkExtension
import TunnelKit import TunnelKit
private let ca = CryptoContainer(pem: """ private let ca = OpenVPN.CryptoContainer(pem: """
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIFqzCCBJOgAwIBAgIJAKZ7D5Yv87qDMA0GCSqGSIb3DQEBDQUAMIHoMQswCQYD MIIFqzCCBJOgAwIBAgIJAKZ7D5Yv87qDMA0GCSqGSIb3DQEBDQUAMIHoMQswCQYD
VQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNVBAcTCkxvc0FuZ2VsZXMxIDAeBgNV VQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNVBAcTCkxvc0FuZ2VsZXMxIDAeBgNV
@ -86,9 +86,9 @@ extension ViewController {
let hostname = ((domain == "") ? server : [server, domain].joined(separator: ".")) let hostname = ((domain == "") ? server : [server, domain].joined(separator: "."))
let port = UInt16(textPort.text!)! let port = UInt16(textPort.text!)!
let credentials = SessionProxy.Credentials(textUsername.text!, textPassword.text!) let credentials = OpenVPN.Credentials(textUsername.text!, textPassword.text!)
var sessionBuilder = SessionProxy.ConfigurationBuilder() var sessionBuilder = OpenVPN.ConfigurationBuilder()
sessionBuilder.ca = ca sessionBuilder.ca = ca
sessionBuilder.cipher = .aes128cbc sessionBuilder.cipher = .aes128cbc
sessionBuilder.digest = .sha1 sessionBuilder.digest = .sha1
@ -98,7 +98,7 @@ extension ViewController {
let socketType: SocketType = switchTCP.isOn ? .tcp : .udp let socketType: SocketType = switchTCP.isOn ? .tcp : .udp
sessionBuilder.endpointProtocols = [EndpointProtocol(socketType, port)] sessionBuilder.endpointProtocols = [EndpointProtocol(socketType, port)]
sessionBuilder.usesPIAPatches = true sessionBuilder.usesPIAPatches = true
var builder = TunnelKitProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build()) var builder = OpenVPNTunnelProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build())
builder.mtu = 1350 builder.mtu = 1350
builder.shouldDebug = true builder.shouldDebug = true
builder.masksPrivateData = false builder.masksPrivateData = false
@ -218,7 +218,7 @@ class ViewController: UIViewController, URLSessionDataDelegate {
guard let vpn = currentManager?.connection as? NETunnelProviderSession else { guard let vpn = currentManager?.connection as? NETunnelProviderSession else {
return return
} }
try? vpn.sendProviderMessage(TunnelKitProvider.Message.requestLog.data) { (data) in try? vpn.sendProviderMessage(OpenVPNTunnelProvider.Message.requestLog.data) { (data) in
guard let data = data, let log = String(data: data, encoding: .utf8) else { guard let data = data, let log = String(data: data, encoding: .utf8) else {
return return
} }

View File

@ -39,7 +39,7 @@ import Cocoa
import NetworkExtension import NetworkExtension
import TunnelKit import TunnelKit
private let ca = CryptoContainer(pem: """ private let ca = OpenVPN.CryptoContainer(pem: """
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIFqzCCBJOgAwIBAgIJAKZ7D5Yv87qDMA0GCSqGSIb3DQEBDQUAMIHoMQswCQYD MIIFqzCCBJOgAwIBAgIJAKZ7D5Yv87qDMA0GCSqGSIb3DQEBDQUAMIHoMQswCQYD
VQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNVBAcTCkxvc0FuZ2VsZXMxIDAeBgNV VQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNVBAcTCkxvc0FuZ2VsZXMxIDAeBgNV
@ -86,9 +86,9 @@ extension ViewController {
let hostname = ((domain == "") ? server : [server, domain].joined(separator: ".")) let hostname = ((domain == "") ? server : [server, domain].joined(separator: "."))
let port = UInt16(textPort.stringValue)! let port = UInt16(textPort.stringValue)!
let credentials = SessionProxy.Credentials(textUsername.stringValue, textPassword.stringValue) let credentials = OpenVPN.Credentials(textUsername.stringValue, textPassword.stringValue)
var sessionBuilder = SessionProxy.ConfigurationBuilder() var sessionBuilder = OpenVPN.ConfigurationBuilder()
sessionBuilder.ca = ca sessionBuilder.ca = ca
sessionBuilder.cipher = .aes128cbc sessionBuilder.cipher = .aes128cbc
sessionBuilder.digest = .sha1 sessionBuilder.digest = .sha1
@ -99,7 +99,7 @@ extension ViewController {
let socketType: SocketType = .udp let socketType: SocketType = .udp
sessionBuilder.endpointProtocols = [EndpointProtocol(socketType, port)] sessionBuilder.endpointProtocols = [EndpointProtocol(socketType, port)]
sessionBuilder.usesPIAPatches = true sessionBuilder.usesPIAPatches = true
var builder = TunnelKitProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build()) var builder = OpenVPNTunnelProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build())
builder.mtu = 1350 builder.mtu = 1350
builder.shouldDebug = true builder.shouldDebug = true
builder.masksPrivateData = false builder.masksPrivateData = false

View File

@ -37,5 +37,5 @@
import TunnelKit import TunnelKit
class PacketTunnelProvider: TunnelKitProvider { class PacketTunnelProvider: OpenVPNTunnelProvider {
} }

View File

@ -37,5 +37,5 @@
import TunnelKit import TunnelKit
class PacketTunnelProvider: TunnelKitProvider { class PacketTunnelProvider: OpenVPNTunnelProvider {
} }

View File

@ -1,15 +1,17 @@
PODS: PODS:
- OpenSSL-Apple (1.1.0j.2) - OpenSSL-Apple (1.1.0j.2)
- SwiftyBeaver (1.7.0) - SwiftyBeaver (1.7.0)
- TunnelKit (1.6.3): - TunnelKit (2.0.0):
- TunnelKit/AppExtension (= 1.6.3) - TunnelKit/Protocols/OpenVPN (= 2.0.0)
- TunnelKit/Core (= 1.6.3) - TunnelKit/AppExtension (2.0.0):
- TunnelKit/AppExtension (1.6.3):
- SwiftyBeaver - SwiftyBeaver
- TunnelKit/Core - TunnelKit/Core
- TunnelKit/Core (1.6.3): - TunnelKit/Core (2.0.0):
- OpenSSL-Apple (~> 1.1.0j.2) - OpenSSL-Apple (~> 1.1.0j.2)
- SwiftyBeaver - SwiftyBeaver
- TunnelKit/Protocols/OpenVPN (2.0.0):
- TunnelKit/AppExtension
- TunnelKit/Core
DEPENDENCIES: DEPENDENCIES:
- TunnelKit (from `..`) - TunnelKit (from `..`)
@ -26,7 +28,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
OpenSSL-Apple: e88e1eb314acb4a05e2348069790c4aa49f6d319 OpenSSL-Apple: e88e1eb314acb4a05e2348069790c4aa49f6d319
SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165 SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165
TunnelKit: ac8dad986e36e513303ed5d258c7e4aedb45c84b TunnelKit: 821c15bb87aafae69eb8c63e4cc46d883fff8797
PODFILE CHECKSUM: f66dfaaa92a8d04ab2743f3caeab0ac9f9f25859 PODFILE CHECKSUM: f66dfaaa92a8d04ab2743f3caeab0ac9f9f25859