Merge branch 'feature/cleanup' into develop

This commit is contained in:
Sergey Abramchuk
2018-01-23 17:24:36 +03:00
493 changed files with 9330 additions and 4248 deletions

View File

@@ -0,0 +1,21 @@
//
// CustomFlow.swift
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 28.10.2017.
//
import NetworkExtension
@testable import OpenVPNAdapter
class CustomFlow: NSObject, OpenVPNAdapterPacketFlow {
func readPackets(completionHandler: @escaping ([Data], [NSNumber]) -> Void) {
}
func writePackets(_ packets: [Data], withProtocols protocols: [NSNumber]) -> Bool {
return true
}
}

View File

@@ -16,6 +16,8 @@ class OpenVPNAdapterTests: XCTestCase {
case connection
}
let customFlow = CustomFlow()
var expectations = [ExpectationsType : XCTestExpectation]()
override func setUp() {
@@ -63,8 +65,8 @@ class OpenVPNAdapterTests: XCTestCase {
}
}
// Test connection without specifying username and password
func testConection() {
// Test connection with local VPN server
func testLocalConection() {
let adapter = OpenVPNAdapter()
let configuration = OpenVPNConfiguration()
@@ -105,15 +107,39 @@ class OpenVPNAdapterTests: XCTestCase {
}
}
// Test connection with remote VPN server
func testRemoteConnection() {
let adapter = OpenVPNAdapter()
let configuration = OpenVPNConfiguration()
configuration.fileContent = ProfileLoader.getVPNProfile(type: .remoteVPNServer)
do {
_ = try adapter.apply(configuration: configuration)
} catch {
XCTFail("Failed to configure OpenVPN adapted due to error: \(error)")
return
}
expectations[.connection] = expectation(description: "me.ss-abramchuk.openvpn-adapter.connection")
adapter.delegate = self
adapter.connect()
waitForExpectations(timeout: 30.0) { (error) in
adapter.disconnect()
}
}
}
extension OpenVPNAdapterTests: OpenVPNAdapterDelegate {
func configureTunnel(settings: NEPacketTunnelNetworkSettings, callback: @escaping (OpenVPNAdapterPacketFlow?) -> Void) {
callback(self)
func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, configureTunnelWithNetworkSettings networkSettings: NEPacketTunnelNetworkSettings, completionHandler: @escaping (OpenVPNAdapterPacketFlow?) -> Void) {
completionHandler(customFlow)
}
func handle(event: OpenVPNAdapterEvent, message: String?) {
func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, handleEvent event: OpenVPNAdapterEvent, message: String?) {
switch event {
case .connected:
guard let connectionExpectation = expectations[.connection] else { return }
@@ -127,23 +153,15 @@ extension OpenVPNAdapterTests: OpenVPNAdapterDelegate {
}
}
func handle(error: Error) {
func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, handleError error: Error) {
if let connectionExpectation = expectations[.connection] {
XCTFail("Failed to establish conection. \(error.localizedDescription)")
connectionExpectation.fulfill()
}
}
func handle(logMessage: String) {
print("\(logMessage)")
func openVPNAdapter(_ openVPNAdapter: OpenVPNAdapter, handleLogMessage logMessage: String) {
print(logMessage)
}
}
extension OpenVPNAdapterTests: OpenVPNAdapterPacketFlow {
func readPackets(completionHandler: @escaping ([Data], [NSNumber]) -> Void) { }
func writePackets(_ packets: [Data], withProtocols protocols: [NSNumber]) -> Bool { return true }
}

View File

@@ -10,6 +10,7 @@ import Foundation
enum ProfileType: String {
case localVPNServer = "local_vpn_server"
case remoteVPNServer = "remote_vpn_server"
}
struct ProfileLoader {

View File

@@ -0,0 +1,214 @@
###############################################################################
# OpenVPN 2.0 Sample Configuration File
# for PacketiX VPN / SoftEther VPN Server
#
# !!! AUTO-GENERATED BY SOFTETHER VPN SERVER MANAGEMENT TOOL !!!
#
# !!! YOU HAVE TO REVIEW IT BEFORE USE AND MODIFY IT AS NECESSARY !!!
#
# This configuration file is auto-generated. You might use this config file
# in order to connect to the PacketiX VPN / SoftEther VPN Server.
# However, before you try it, you should review the descriptions of the file
# to determine the necessity to modify to suitable for your real environment.
# If necessary, you have to modify a little adequately on the file.
# For example, the IP address or the hostname as a destination VPN Server
# should be confirmed.
#
# Note that to use OpenVPN 2.0, you have to put the certification file of
# the destination VPN Server on the OpenVPN Client computer when you use this
# config file. Please refer the below descriptions carefully.
###############################################################################
# Specify the type of the layer of the VPN connection.
#
# To connect to the VPN Server as a "Remote-Access VPN Client PC",
# specify 'dev tun'. (Layer-3 IP Routing Mode)
#
# To connect to the VPN Server as a bridging equipment of "Site-to-Site VPN",
# specify 'dev tap'. (Layer-2 Ethernet Bridgine Mode)
dev tun
###############################################################################
# Specify the underlying protocol beyond the Internet.
# Note that this setting must be correspond with the listening setting on
# the VPN Server.
#
# Specify either 'proto tcp' or 'proto udp'.
proto udp
###############################################################################
# The destination hostname / IP address, and port number of
# the target VPN Server.
#
# You have to specify as 'remote <HOSTNAME> <PORT>'. You can also
# specify the IP address instead of the hostname.
#
# Note that the auto-generated below hostname are a "auto-detected
# IP address" of the VPN Server. You have to confirm the correctness
# beforehand.
#
# When you want to connect to the VPN Server by using TCP protocol,
# the port number of the destination TCP port should be same as one of
# the available TCP listeners on the VPN Server.
#
# When you use UDP protocol, the port number must same as the configuration
# setting of "OpenVPN Server Compatible Function" on the VPN Server.
remote vpn152461132.opengw.net 1840
###############################################################################
# The HTTP/HTTPS proxy setting.
#
# Only if you have to use the Internet via a proxy, uncomment the below
# two lines and specify the proxy address and the port number.
# In the case of using proxy-authentication, refer the OpenVPN manual.
;http-proxy-retry
;http-proxy [proxy server] [proxy port]
###############################################################################
# The encryption and authentication algorithm.
#
# Default setting is good. Modify it as you prefer.
# When you specify an unsupported algorithm, the error will occur.
#
# The supported algorithms are as follows:
# cipher: [NULL-CIPHER] NULL AES-128-CBC AES-192-CBC AES-256-CBC BF-CBC
# CAST-CBC CAST5-CBC DES-CBC DES-EDE-CBC DES-EDE3-CBC DESX-CBC
# RC2-40-CBC RC2-64-CBC RC2-CBC
# auth: SHA SHA1 MD5 MD4 RMD160
cipher AES-128-CBC
auth SHA1
###############################################################################
# Other parameters necessary to connect to the VPN Server.
#
# It is not recommended to modify it unless you have a particular need.
resolv-retry infinite
nobind
persist-key
persist-tun
client
verb 3
###############################################################################
# The certificate file of the destination VPN Server.
#
# The CA certificate file is embedded in the inline format.
# You can replace this CA contents if necessary.
# Please note that if the server certificate is not a self-signed, you have to
# specify the signer's root certificate (CA) here.
<ca>
-----BEGIN CERTIFICATE-----
MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCB
hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV
BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMTE5
MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgT
EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNh
dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR
6FSS0gpWsawNJN3Fz0RndJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8X
pz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZFGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC
9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+5eNu/Nio5JIk2kNrYrhV
/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pGx8cgoLEf
Zd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z
+pUX2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7w
qP/0uK3pN/u6uPQLOvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZah
SL0896+1DSJMwBGB7FY79tOi4lu3sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVIC
u9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+CGCe01a60y1Dma/RMhnEw6abf
Fobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5WdYgGq/yapiq
crxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB
/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvl
wFTPoCWOAvn9sKIN9SCYPBMtrFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM
4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+nq6PK7o9mfjYcwlYRm6mnPTXJ9OV
2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSgtZx8jb8uk2Intzna
FxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwWsRqZ
CuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiK
boHGhfKppC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmcke
jkk9u+UJueBPSZI9FoJAzMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yL
S0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHqZJx64SIDqZxubw5lT2yHh17zbqD5daWb
QOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk527RH89elWsn2/x20Kk4yl
0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7ILaZRfyHB
NVOFBkpdn627G190
-----END CERTIFICATE-----
</ca>
###############################################################################
# The client certificate file (dummy).
#
# In some implementations of OpenVPN Client software
# (for example: OpenVPN Client for iOS),
# a pair of client certificate and private key must be included on the
# configuration file due to the limitation of the client.
# So this sample configuration file has a dummy pair of client certificate
# and private key as follows.
<cert>
-----BEGIN CERTIFICATE-----
MIICxjCCAa4CAQAwDQYJKoZIhvcNAQEFBQAwKTEaMBgGA1UEAxMRVlBOR2F0ZUNs
aWVudENlcnQxCzAJBgNVBAYTAkpQMB4XDTEzMDIxMTAzNDk0OVoXDTM3MDExOTAz
MTQwN1owKTEaMBgGA1UEAxMRVlBOR2F0ZUNsaWVudENlcnQxCzAJBgNVBAYTAkpQ
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5h2lgQQYUjwoKYJbzVZA
5VcIGd5otPc/qZRMt0KItCFA0s9RwReNVa9fDRFLRBhcITOlv3FBcW3E8h1Us7RD
4W8GmJe8zapJnLsD39OSMRCzZJnczW4OCH1PZRZWKqDtjlNca9AF8a65jTmlDxCQ
CjntLIWk5OLLVkFt9/tScc1GDtci55ofhaNAYMPiH7V8+1g66pGHXAoWK6AQVH67
XCKJnGB5nlQ+HsMYPV/O49Ld91ZN/2tHkcaLLyNtywxVPRSsRh480jju0fcCsv6h
p/0yXnTB//mWutBGpdUlIbwiITbAmrsbYnjigRvnPqX1RNJUbi9Fp6C2c/HIFJGD
ywIDAQABMA0GCSqGSIb3DQEBBQUAA4IBAQChO5hgcw/4oWfoEFLu9kBa1B//kxH8
hQkChVNn8BRC7Y0URQitPl3DKEed9URBDdg2KOAz77bb6ENPiliD+a38UJHIRMqe
UBHhllOHIzvDhHFbaovALBQceeBzdkQxsKQESKmQmR832950UCovoyRB61UyAV7h
+mZhYPGRKXKSJI6s0Egg/Cri+Cwk4bjJfrb5hVse11yh4D9MHhwSfCOH+0z4hPUT
Fku7dGavURO5SVxMn/sL6En5D+oSeXkadHpDs+Airym2YHh15h0+jPSOoR6yiVp/
6zZeZkrN43kuS73KpKDFjfFPh8t4r1gOIjttkNcQqBccusnplQ7HJpsk
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA5h2lgQQYUjwoKYJbzVZA5VcIGd5otPc/qZRMt0KItCFA0s9R
wReNVa9fDRFLRBhcITOlv3FBcW3E8h1Us7RD4W8GmJe8zapJnLsD39OSMRCzZJnc
zW4OCH1PZRZWKqDtjlNca9AF8a65jTmlDxCQCjntLIWk5OLLVkFt9/tScc1GDtci
55ofhaNAYMPiH7V8+1g66pGHXAoWK6AQVH67XCKJnGB5nlQ+HsMYPV/O49Ld91ZN
/2tHkcaLLyNtywxVPRSsRh480jju0fcCsv6hp/0yXnTB//mWutBGpdUlIbwiITbA
mrsbYnjigRvnPqX1RNJUbi9Fp6C2c/HIFJGDywIDAQABAoIBAERV7X5AvxA8uRiK
k8SIpsD0dX1pJOMIwakUVyvc4EfN0DhKRNb4rYoSiEGTLyzLpyBc/A28Dlkm5eOY
fjzXfYkGtYi/Ftxkg3O9vcrMQ4+6i+uGHaIL2rL+s4MrfO8v1xv6+Wky33EEGCou
QiwVGRFQXnRoQ62NBCFbUNLhmXwdj1akZzLU4p5R4zA3QhdxwEIatVLt0+7owLQ3
lP8sfXhppPOXjTqMD4QkYwzPAa8/zF7acn4kryrUP7Q6PAfd0zEVqNy9ZCZ9ffho
zXedFj486IFoc5gnTp2N6jsnVj4LCGIhlVHlYGozKKFqJcQVGsHCqq1oz2zjW6LS
oRYIHgECgYEA8zZrkCwNYSXJuODJ3m/hOLVxcxgJuwXoiErWd0E42vPanjjVMhnt
KY5l8qGMJ6FhK9LYx2qCrf/E0XtUAZ2wVq3ORTyGnsMWre9tLYs55X+ZN10Tc75z
4hacbU0hqKN1HiDmsMRY3/2NaZHoy7MKnwJJBaG48l9CCTlVwMHocIECgYEA8jby
dGjxTH+6XHWNizb5SRbZxAnyEeJeRwTMh0gGzwGPpH/sZYGzyu0SySXWCnZh3Rgq
5uLlNxtrXrljZlyi2nQdQgsq2YrWUs0+zgU+22uQsZpSAftmhVrtvet6MjVjbByY
DADciEVUdJYIXk+qnFUJyeroLIkTj7WYKZ6RjksCgYBoCFIwRDeg42oK89RFmnOr
LymNAq4+2oMhsWlVb4ejWIWeAk9nc+GXUfrXszRhS01mUnU5r5ygUvRcarV/T3U7
TnMZ+I7Y4DgWRIDd51znhxIBtYV5j/C/t85HjqOkH+8b6RTkbchaX3mau7fpUfds
Fq0nhIq42fhEO8srfYYwgQKBgQCyhi1N/8taRwpk+3/IDEzQwjbfdzUkWWSDk9Xs
H/pkuRHWfTMP3flWqEYgW/LW40peW2HDq5imdV8+AgZxe/XMbaji9Lgwf1RY005n
KxaZQz7yqHupWlLGF68DPHxkZVVSagDnV/sztWX6SFsCqFVnxIXifXGC4cW5Nm9g
va8q4QKBgQCEhLVeUfdwKvkZ94g/GFz731Z2hrdVhgMZaU/u6t0V95+YezPNCQZB
wmE9Mmlbq1emDeROivjCfoGhR3kZXW1pTKlLh6ZMUQUOpptdXva8XxfoqQwa3enA
M7muBbF0XN7VO80iJPv+PmIZdEIAkpwKfi201YB+BafCIuGxIF50Vg==
-----END RSA PRIVATE KEY-----
</key>

View File

@@ -7,6 +7,18 @@
objects = {
/* Begin PBXBuildFile section */
ABD6EF091F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = ABD6EF071F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.h */; };
ABD6EF0A1F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = ABD6EF071F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.h */; };
ABD6EF0B1F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = ABD6EF081F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.m */; };
ABD6EF0C1F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = ABD6EF081F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.m */; };
ABD6EF101F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = ABD6EF0E1F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.h */; };
ABD6EF111F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = ABD6EF0E1F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.h */; };
ABD6EF121F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABD6EF0F1F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.mm */; };
ABD6EF131F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABD6EF0F1F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.mm */; };
ABD6EF171F8F9C38007D3D90 /* OpenVPNAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = ABD6EF151F8F9C37007D3D90 /* OpenVPNAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; };
ABD6EF181F8F9C38007D3D90 /* OpenVPNAdapter.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABD6EF161F8F9C38007D3D90 /* OpenVPNAdapter.mm */; };
ABD6EF191F8F9C3B007D3D90 /* OpenVPNAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = ABD6EF151F8F9C37007D3D90 /* OpenVPNAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; };
ABD6EF1A1F8F9C3B007D3D90 /* OpenVPNAdapter.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABD6EF161F8F9C38007D3D90 /* OpenVPNAdapter.mm */; };
C90BAD311E73FF6C00DEFB32 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C90BAD301E73FF6C00DEFB32 /* SystemConfiguration.framework */; };
C912BB251E7C3339002B9414 /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C912BB241E7C3339002B9414 /* NetworkExtension.framework */; };
C915F1F41F612F3300B3DF23 /* OpenVPNPrivateKey.h in Headers */ = {isa = PBXBuildFile; fileRef = C915F1F21F612F3300B3DF23 /* OpenVPNPrivateKey.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -99,12 +111,6 @@
C9BB47601E71663A00F3F98C /* Umbrella-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB475E1E71663A00F3F98C /* Umbrella-Header.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9BB47711E7171A100F3F98C /* OpenVPNError.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB476F1E7171A100F3F98C /* OpenVPNError.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9BB47721E7171A100F3F98C /* OpenVPNAdapterEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB47701E7171A100F3F98C /* OpenVPNAdapterEvent.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9BB47791E7171ED00F3F98C /* OpenVPNClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB47771E7171ED00F3F98C /* OpenVPNClient.h */; };
C9BB477A1E7171ED00F3F98C /* OpenVPNClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9BB47781E7171ED00F3F98C /* OpenVPNClient.mm */; };
C9BB477F1E7173C700F3F98C /* OpenVPNAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB477B1E7173C700F3F98C /* OpenVPNAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9BB47801E7173C700F3F98C /* OpenVPNAdapter+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB477C1E7173C700F3F98C /* OpenVPNAdapter+Internal.h */; };
C9BB47811E7173C700F3F98C /* OpenVPNAdapter+Public.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB477D1E7173C700F3F98C /* OpenVPNAdapter+Public.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9BB47821E7173C700F3F98C /* OpenVPNAdapter.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9BB477E1E7173C700F3F98C /* OpenVPNAdapter.mm */; };
C9BB47911E71821A00F3F98C /* OpenVPNAdapterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9BB47901E71821A00F3F98C /* OpenVPNAdapterTests.swift */; };
C9BB47931E71821A00F3F98C /* OpenVPNAdapter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9BB475C1E71663A00F3F98C /* OpenVPNAdapter.framework */; };
C9BB47A21E7183DB00F3F98C /* Bundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9BB47A11E7183DB00F3F98C /* Bundle.swift */; };
@@ -114,36 +120,40 @@
C9BCE25B1EB3C0D9009D6AC1 /* OpenVPNSessionToken.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9BCE2571EB3C0D9009D6AC1 /* OpenVPNSessionToken.mm */; };
C9BCE25E1EB3C201009D6AC1 /* OpenVPNSessionToken+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BCE25C1EB3C201009D6AC1 /* OpenVPNSessionToken+Internal.h */; };
C9BCE25F1EB3C201009D6AC1 /* OpenVPNSessionToken+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BCE25C1EB3C201009D6AC1 /* OpenVPNSessionToken+Internal.h */; };
C9BDB1351EBCC3B900C204FF /* OpenVPNTunnelSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BDB1331EBCC3B900C204FF /* OpenVPNTunnelSettings.h */; };
C9BDB1361EBCC3B900C204FF /* OpenVPNTunnelSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BDB1331EBCC3B900C204FF /* OpenVPNTunnelSettings.h */; };
C9BDB1371EBCC3B900C204FF /* OpenVPNTunnelSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = C9BDB1341EBCC3B900C204FF /* OpenVPNTunnelSettings.m */; };
C9BDB1381EBCC3B900C204FF /* OpenVPNTunnelSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = C9BDB1341EBCC3B900C204FF /* OpenVPNTunnelSettings.m */; };
C9C1E4101FA47117006ECA7D /* remote_vpn_server.ovpn in Resources */ = {isa = PBXBuildFile; fileRef = C9C1E40F1FA47117006ECA7D /* remote_vpn_server.ovpn */; };
C9C1E4111FA47117006ECA7D /* remote_vpn_server.ovpn in Resources */ = {isa = PBXBuildFile; fileRef = C9C1E40F1FA47117006ECA7D /* remote_vpn_server.ovpn */; };
C9C1E4141FA475B7006ECA7D /* CustomFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9C1E4131FA475B7006ECA7D /* CustomFlow.swift */; };
C9C1E4151FA475B7006ECA7D /* CustomFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9C1E4131FA475B7006ECA7D /* CustomFlow.swift */; };
C9C2B2B7200CB42F00CA0FF3 /* OpenVPNAdapterPacketFlow.h in Headers */ = {isa = PBXBuildFile; fileRef = C9C2B2B6200CB42F00CA0FF3 /* OpenVPNAdapterPacketFlow.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9C2B2B8200CB42F00CA0FF3 /* OpenVPNAdapterPacketFlow.h in Headers */ = {isa = PBXBuildFile; fileRef = C9C2B2B6200CB42F00CA0FF3 /* OpenVPNAdapterPacketFlow.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9C2B2BB200CC42A00CA0FF3 /* OpenVPNPacket.h in Headers */ = {isa = PBXBuildFile; fileRef = C9C2B2B9200CC42A00CA0FF3 /* OpenVPNPacket.h */; };
C9C2B2BC200CC42A00CA0FF3 /* OpenVPNPacket.h in Headers */ = {isa = PBXBuildFile; fileRef = C9C2B2B9200CC42A00CA0FF3 /* OpenVPNPacket.h */; };
C9C2B2BD200CC42A00CA0FF3 /* OpenVPNPacket.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9C2B2BA200CC42A00CA0FF3 /* OpenVPNPacket.mm */; };
C9C2B2BE200CC42A00CA0FF3 /* OpenVPNPacket.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9C2B2BA200CC42A00CA0FF3 /* OpenVPNPacket.mm */; };
C9CA4DD31F602F7B00C4F184 /* OpenVPNCertificate.h in Headers */ = {isa = PBXBuildFile; fileRef = C9CA4DD11F602F7B00C4F184 /* OpenVPNCertificate.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9CA4DD41F602F7B00C4F184 /* OpenVPNCertificate.h in Headers */ = {isa = PBXBuildFile; fileRef = C9CA4DD11F602F7B00C4F184 /* OpenVPNCertificate.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9CA4DD51F602F7B00C4F184 /* OpenVPNCertificate.m in Sources */ = {isa = PBXBuildFile; fileRef = C9CA4DD21F602F7B00C4F184 /* OpenVPNCertificate.m */; };
C9CA4DD61F602F7B00C4F184 /* OpenVPNCertificate.m in Sources */ = {isa = PBXBuildFile; fileRef = C9CA4DD21F602F7B00C4F184 /* OpenVPNCertificate.m */; };
C9CA4DE11F603A5300C4F184 /* OpenVPNCertificateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CA4DE01F603A5300C4F184 /* OpenVPNCertificateTests.swift */; };
C9CA4DE21F603A5300C4F184 /* OpenVPNCertificateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CA4DE01F603A5300C4F184 /* OpenVPNCertificateTests.swift */; };
C9D2ABDB1EA20F99007EDF9D /* OpenVPNAdapter.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9BB477E1E7173C700F3F98C /* OpenVPNAdapter.mm */; };
C9D2ABDC1EA20F99007EDF9D /* OpenVPNClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9BB47781E7171ED00F3F98C /* OpenVPNClient.mm */; };
C9CDFDDB200781AF00323B73 /* OpenVPNClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C9CDFDD9200781AF00323B73 /* OpenVPNClient.h */; };
C9CDFDDC200781AF00323B73 /* OpenVPNClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C9CDFDD9200781AF00323B73 /* OpenVPNClient.h */; };
C9CDFDDD200781AF00323B73 /* OpenVPNClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9CDFDDA200781AF00323B73 /* OpenVPNClient.mm */; };
C9CDFDDE200781AF00323B73 /* OpenVPNClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9CDFDDA200781AF00323B73 /* OpenVPNClient.mm */; };
C9D2ABDE1EA20F99007EDF9D /* ovpncli.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C9FD92191E9A667600374FC4 /* ovpncli.cpp */; };
C9D2ABE01EA20F99007EDF9D /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C912BB241E7C3339002B9414 /* NetworkExtension.framework */; };
C9D2ABE11EA20F99007EDF9D /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C90BAD301E73FF6C00DEFB32 /* SystemConfiguration.framework */; };
C9D2ABE31EA20F99007EDF9D /* OpenVPNClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB47771E7171ED00F3F98C /* OpenVPNClient.h */; };
C9D2ABE41EA20F99007EDF9D /* OpenVPNAdapterEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB47701E7171A100F3F98C /* OpenVPNAdapterEvent.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9D2ABE51EA20F99007EDF9D /* OpenVPNAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB477B1E7173C700F3F98C /* OpenVPNAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9D2ABE61EA20F99007EDF9D /* Umbrella-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB475E1E71663A00F3F98C /* Umbrella-Header.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9D2ABE71EA20F99007EDF9D /* OpenVPNAdapter+Public.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB477D1E7173C700F3F98C /* OpenVPNAdapter+Public.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9D2ABE81EA20F99007EDF9D /* OpenVPNError.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB476F1E7171A100F3F98C /* OpenVPNError.h */; settings = {ATTRIBUTES = (Public, ); }; };
C9D2ABE91EA20F99007EDF9D /* OpenVPNAdapter+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB477C1E7173C700F3F98C /* OpenVPNAdapter+Internal.h */; };
C9D2ABEA1EA20F99007EDF9D /* ovpncli.hpp in Headers */ = {isa = PBXBuildFile; fileRef = C9FD92181E9A667600374FC4 /* ovpncli.hpp */; };
C9D2ABF61EA212A3007EDF9D /* OpenVPNAdapterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9BB47901E71821A00F3F98C /* OpenVPNAdapterTests.swift */; };
C9D2ABF71EA212A3007EDF9D /* Bundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9BB47A11E7183DB00F3F98C /* Bundle.swift */; };
C9D2AC051EA214EA007EDF9D /* OpenVPNAdapter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9D2ABF01EA20F99007EDF9D /* OpenVPNAdapter.framework */; };
C9E4401D1F6086A1001D7C41 /* NSError+Message.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E4401B1F6086A1001D7C41 /* NSError+Message.h */; };
C9E4401E1F6086A1001D7C41 /* NSError+Message.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E4401B1F6086A1001D7C41 /* NSError+Message.h */; };
C9E4401F1F6086A1001D7C41 /* NSError+Message.m in Sources */ = {isa = PBXBuildFile; fileRef = C9E4401C1F6086A1001D7C41 /* NSError+Message.m */; };
C9E440201F6086A1001D7C41 /* NSError+Message.m in Sources */ = {isa = PBXBuildFile; fileRef = C9E4401C1F6086A1001D7C41 /* NSError+Message.m */; };
C9E350C1200F6EC0000820D9 /* NSError+OpenVPNError.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E350BF200F6EC0000820D9 /* NSError+OpenVPNError.h */; };
C9E350C2200F6EC0000820D9 /* NSError+OpenVPNError.h in Headers */ = {isa = PBXBuildFile; fileRef = C9E350BF200F6EC0000820D9 /* NSError+OpenVPNError.h */; };
C9E350C3200F6EC0000820D9 /* NSError+OpenVPNError.m in Sources */ = {isa = PBXBuildFile; fileRef = C9E350C0200F6EC0000820D9 /* NSError+OpenVPNError.m */; };
C9E350C4200F6EC0000820D9 /* NSError+OpenVPNError.m in Sources */ = {isa = PBXBuildFile; fileRef = C9E350C0200F6EC0000820D9 /* NSError+OpenVPNError.m */; };
C9FD921A1E9A667600374FC4 /* ovpncli.hpp in Headers */ = {isa = PBXBuildFile; fileRef = C9FD92181E9A667600374FC4 /* ovpncli.hpp */; };
C9FD921B1E9A667600374FC4 /* ovpncli.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C9FD92191E9A667600374FC4 /* ovpncli.cpp */; };
/* End PBXBuildFile section */
@@ -166,6 +176,12 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
ABD6EF071F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNNetworkSettingsBuilder.h; sourceTree = "<group>"; };
ABD6EF081F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OpenVPNNetworkSettingsBuilder.m; sourceTree = "<group>"; };
ABD6EF0E1F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNPacketFlowBridge.h; sourceTree = "<group>"; };
ABD6EF0F1F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNPacketFlowBridge.mm; sourceTree = "<group>"; };
ABD6EF151F8F9C37007D3D90 /* OpenVPNAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapter.h; sourceTree = "<group>"; };
ABD6EF161F8F9C38007D3D90 /* OpenVPNAdapter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNAdapter.mm; sourceTree = "<group>"; };
C90BAD261E73F47E00DEFB32 /* Info-Framework.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Framework.plist"; sourceTree = "<group>"; };
C90BAD271E73F47E00DEFB32 /* Info-Tests.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Tests.plist"; sourceTree = "<group>"; };
C90BAD291E73F56800DEFB32 /* Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Framework.xcconfig; sourceTree = "<group>"; };
@@ -223,27 +239,26 @@
C9BB475E1E71663A00F3F98C /* Umbrella-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Umbrella-Header.h"; sourceTree = "<group>"; };
C9BB476F1E7171A100F3F98C /* OpenVPNError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = OpenVPNError.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
C9BB47701E7171A100F3F98C /* OpenVPNAdapterEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapterEvent.h; sourceTree = "<group>"; };
C9BB47771E7171ED00F3F98C /* OpenVPNClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNClient.h; sourceTree = "<group>"; };
C9BB47781E7171ED00F3F98C /* OpenVPNClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNClient.mm; sourceTree = "<group>"; };
C9BB477B1E7173C700F3F98C /* OpenVPNAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapter.h; sourceTree = "<group>"; };
C9BB477C1E7173C700F3F98C /* OpenVPNAdapter+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OpenVPNAdapter+Internal.h"; sourceTree = "<group>"; };
C9BB477D1E7173C700F3F98C /* OpenVPNAdapter+Public.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OpenVPNAdapter+Public.h"; sourceTree = "<group>"; };
C9BB477E1E7173C700F3F98C /* OpenVPNAdapter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = OpenVPNAdapter.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
C9BB478E1E71821A00F3F98C /* OpenVPNAdapterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OpenVPNAdapterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
C9BB47901E71821A00F3F98C /* OpenVPNAdapterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenVPNAdapterTests.swift; sourceTree = "<group>"; };
C9BB47A11E7183DB00F3F98C /* Bundle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = "<group>"; };
C9BCE2561EB3C0D9009D6AC1 /* OpenVPNSessionToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNSessionToken.h; sourceTree = "<group>"; };
C9BCE2571EB3C0D9009D6AC1 /* OpenVPNSessionToken.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNSessionToken.mm; sourceTree = "<group>"; };
C9BCE25C1EB3C201009D6AC1 /* OpenVPNSessionToken+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OpenVPNSessionToken+Internal.h"; sourceTree = "<group>"; };
C9BDB1331EBCC3B900C204FF /* OpenVPNTunnelSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNTunnelSettings.h; sourceTree = "<group>"; };
C9BDB1341EBCC3B900C204FF /* OpenVPNTunnelSettings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OpenVPNTunnelSettings.m; sourceTree = "<group>"; };
C9C1E40F1FA47117006ECA7D /* remote_vpn_server.ovpn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = remote_vpn_server.ovpn; sourceTree = "<group>"; };
C9C1E4131FA475B7006ECA7D /* CustomFlow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomFlow.swift; sourceTree = "<group>"; };
C9C2B2B6200CB42F00CA0FF3 /* OpenVPNAdapterPacketFlow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapterPacketFlow.h; sourceTree = "<group>"; };
C9C2B2B9200CC42A00CA0FF3 /* OpenVPNPacket.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNPacket.h; sourceTree = "<group>"; };
C9C2B2BA200CC42A00CA0FF3 /* OpenVPNPacket.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNPacket.mm; sourceTree = "<group>"; };
C9CA4DD11F602F7B00C4F184 /* OpenVPNCertificate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNCertificate.h; sourceTree = "<group>"; };
C9CA4DD21F602F7B00C4F184 /* OpenVPNCertificate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OpenVPNCertificate.m; sourceTree = "<group>"; };
C9CA4DE01F603A5300C4F184 /* OpenVPNCertificateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenVPNCertificateTests.swift; sourceTree = "<group>"; };
C9CDFDD9200781AF00323B73 /* OpenVPNClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenVPNClient.h; sourceTree = "<group>"; };
C9CDFDDA200781AF00323B73 /* OpenVPNClient.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNClient.mm; sourceTree = "<group>"; };
C9D2ABF01EA20F99007EDF9D /* OpenVPNAdapter.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OpenVPNAdapter.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C9D2ABFF1EA212A3007EDF9D /* OpenVPNAdapterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OpenVPNAdapterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
C9E4401B1F6086A1001D7C41 /* NSError+Message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSError+Message.h"; sourceTree = "<group>"; };
C9E4401C1F6086A1001D7C41 /* NSError+Message.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSError+Message.m"; sourceTree = "<group>"; };
C9E350BF200F6EC0000820D9 /* NSError+OpenVPNError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSError+OpenVPNError.h"; sourceTree = "<group>"; };
C9E350C0200F6EC0000820D9 /* NSError+OpenVPNError.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSError+OpenVPNError.m"; sourceTree = "<group>"; };
C9FD92181E9A667600374FC4 /* ovpncli.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ovpncli.hpp; path = Vendors/openvpn/client/ovpncli.hpp; sourceTree = "<group>"; };
C9FD92191E9A667600374FC4 /* ovpncli.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ovpncli.cpp; path = Vendors/openvpn/client/ovpncli.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -334,8 +349,11 @@
C9235AC41EB24F0100C7D303 /* Configuration */ = {
isa = PBXGroup;
children = (
C9BDB1331EBCC3B900C204FF /* OpenVPNTunnelSettings.h */,
C9BDB1341EBCC3B900C204FF /* OpenVPNTunnelSettings.m */,
C9657A5D1EB0D60700EFF210 /* OpenVPNTransportProtocol.h */,
C9657A601EB0D64E00EFF210 /* OpenVPNIPv6Preference.h */,
C9657A631EB0D6AD00EFF210 /* OpenVPNCompressionMode.h */,
C9657A661EB0D73200EFF210 /* OpenVPNMinTLSVersion.h */,
C9657A691EB0D75700EFF210 /* OpenVPNTLSCertProfile.h */,
C98467A41EAA5B7700272A9A /* OpenVPNConfiguration.h */,
C98467AA1EAA5BB500272A9A /* OpenVPNConfiguration+Internal.h */,
C98467A51EAA5B7700272A9A /* OpenVPNConfiguration.mm */,
@@ -371,26 +389,10 @@
name = "Stats and Info";
sourceTree = "<group>";
};
C9235AC61EB24F2A00C7D303 /* Types and Constants */ = {
isa = PBXGroup;
children = (
C9BB476F1E7171A100F3F98C /* OpenVPNError.h */,
C93A4F611EE18009004DC561 /* OpenVPNError.m */,
C9BB47701E7171A100F3F98C /* OpenVPNAdapterEvent.h */,
C9657A5D1EB0D60700EFF210 /* OpenVPNTransportProtocol.h */,
C9657A601EB0D64E00EFF210 /* OpenVPNIPv6Preference.h */,
C9657A631EB0D6AD00EFF210 /* OpenVPNCompressionMode.h */,
C9657A661EB0D73200EFF210 /* OpenVPNMinTLSVersion.h */,
C9657A691EB0D75700EFF210 /* OpenVPNTLSCertProfile.h */,
C915F1FD1F6164CF00B3DF23 /* OpenVPNKeyType.h */,
C9B795681F1D219C00CF35FE /* OpenVPNReachabilityStatus.h */,
);
name = "Types and Constants";
sourceTree = "<group>";
};
C9B7955B1F1D165700CF35FE /* Reachability */ = {
isa = PBXGroup;
children = (
C9B795681F1D219C00CF35FE /* OpenVPNReachabilityStatus.h */,
C9B795621F1D182500CF35FE /* OpenVPNReachabilityTracker.h */,
C9B795631F1D182500CF35FE /* OpenVPNReachabilityTracker.mm */,
C9B7955C1F1D16AA00CF35FE /* OpenVPNReachability.h */,
@@ -434,12 +436,20 @@
C9BB47671E7169F000F3F98C /* Adapter */ = {
isa = PBXGroup;
children = (
C9BB47771E7171ED00F3F98C /* OpenVPNClient.h */,
C9BB47781E7171ED00F3F98C /* OpenVPNClient.mm */,
C9BB477B1E7173C700F3F98C /* OpenVPNAdapter.h */,
C9BB477C1E7173C700F3F98C /* OpenVPNAdapter+Internal.h */,
C9BB477D1E7173C700F3F98C /* OpenVPNAdapter+Public.h */,
C9BB477E1E7173C700F3F98C /* OpenVPNAdapter.mm */,
C9BB47701E7171A100F3F98C /* OpenVPNAdapterEvent.h */,
C9BB476F1E7171A100F3F98C /* OpenVPNError.h */,
C93A4F611EE18009004DC561 /* OpenVPNError.m */,
C9CDFDD9200781AF00323B73 /* OpenVPNClient.h */,
C9CDFDDA200781AF00323B73 /* OpenVPNClient.mm */,
ABD6EF071F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.h */,
ABD6EF081F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.m */,
C9C2B2B6200CB42F00CA0FF3 /* OpenVPNAdapterPacketFlow.h */,
C9C2B2B9200CC42A00CA0FF3 /* OpenVPNPacket.h */,
C9C2B2BA200CC42A00CA0FF3 /* OpenVPNPacket.mm */,
ABD6EF0E1F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.h */,
ABD6EF0F1F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.mm */,
ABD6EF151F8F9C37007D3D90 /* OpenVPNAdapter.h */,
ABD6EF161F8F9C38007D3D90 /* OpenVPNAdapter.mm */,
);
name = Adapter;
sourceTree = "<group>";
@@ -477,7 +487,6 @@
C915F2241F61B22300B3DF23 /* test-ca.crt */,
C915F21E1F6199E300B3DF23 /* keyfile-encrypted.3des */,
C915F2211F61B0E700B3DF23 /* keyfile-decrypted.3des */,
C98467A11EAA559B00272A9A /* local_vpn_server.ovpn */,
);
path = Resources;
sourceTree = "<group>";
@@ -497,6 +506,8 @@
C9BB479E1E7183B800F3F98C /* Libraries */ = {
isa = PBXGroup;
children = (
C9C1E40E1FA470EB006ECA7D /* Configuration */,
C9C1E4121FA47586006ECA7D /* Base */,
C9BB479F1E7183C200F3F98C /* Helpers */,
);
name = Libraries;
@@ -519,9 +530,27 @@
name = Utils;
sourceTree = "<group>";
};
C9C1E40E1FA470EB006ECA7D /* Configuration */ = {
isa = PBXGroup;
children = (
C98467A11EAA559B00272A9A /* local_vpn_server.ovpn */,
C9C1E40F1FA47117006ECA7D /* remote_vpn_server.ovpn */,
);
name = Configuration;
sourceTree = "<group>";
};
C9C1E4121FA47586006ECA7D /* Base */ = {
isa = PBXGroup;
children = (
C9C1E4131FA475B7006ECA7D /* CustomFlow.swift */,
);
name = Base;
sourceTree = "<group>";
};
C9CA4DD01F602D8300C4F184 /* Certificates and Keys */ = {
isa = PBXGroup;
children = (
C915F1FD1F6164CF00B3DF23 /* OpenVPNKeyType.h */,
C9CA4DD11F602F7B00C4F184 /* OpenVPNCertificate.h */,
C9CA4DD21F602F7B00C4F184 /* OpenVPNCertificate.m */,
C915F1F21F612F3300B3DF23 /* OpenVPNPrivateKey.h */,
@@ -530,20 +559,19 @@
name = "Certificates and Keys";
sourceTree = "<group>";
};
C9E4401A1F6081FF001D7C41 /* Utils */ = {
C9E350C5200F70CA000820D9 /* Extensions */ = {
isa = PBXGroup;
children = (
C9E4401B1F6086A1001D7C41 /* NSError+Message.h */,
C9E4401C1F6086A1001D7C41 /* NSError+Message.m */,
C9E350BF200F6EC0000820D9 /* NSError+OpenVPNError.h */,
C9E350C0200F6EC0000820D9 /* NSError+OpenVPNError.m */,
);
name = Utils;
name = Extensions;
sourceTree = "<group>";
};
C9FF73B71EB7421600E995AC /* Helpers */ = {
isa = PBXGroup;
children = (
C9235AC61EB24F2A00C7D303 /* Types and Constants */,
C9E4401A1F6081FF001D7C41 /* Utils */,
C9E350C5200F70CA000820D9 /* Extensions */,
);
name = Helpers;
sourceTree = "<group>";
@@ -556,22 +584,22 @@
buildActionMask = 2147483647;
files = (
C9CA4DD31F602F7B00C4F184 /* OpenVPNCertificate.h in Headers */,
C9BB47791E7171ED00F3F98C /* OpenVPNClient.h in Headers */,
C9CDFDDB200781AF00323B73 /* OpenVPNClient.h in Headers */,
C9657A3A1EB0BAAB00EFF210 /* OpenVPNInterfaceStats+Internal.h in Headers */,
C9354F451F1E4A4500F4C935 /* OpenVPNReachabilityStatus.h in Headers */,
C9BCE25E1EB3C201009D6AC1 /* OpenVPNSessionToken+Internal.h in Headers */,
C9BB47721E7171A100F3F98C /* OpenVPNAdapterEvent.h in Headers */,
C9BB477F1E7173C700F3F98C /* OpenVPNAdapter.h in Headers */,
ABD6EF171F8F9C38007D3D90 /* OpenVPNAdapter.h in Headers */,
C915F1FE1F6164CF00B3DF23 /* OpenVPNKeyType.h in Headers */,
C9657A4C1EB0CD6C00EFF210 /* OpenVPNProperties.h in Headers */,
C9657A571EB0CDFB00EFF210 /* OpenVPNProperties+Internal.h in Headers */,
C9BCE2581EB3C0D9009D6AC1 /* OpenVPNSessionToken.h in Headers */,
C9657A341EB0BA3900EFF210 /* OpenVPNInterfaceStats.h in Headers */,
C9BDB1351EBCC3B900C204FF /* OpenVPNTunnelSettings.h in Headers */,
C9657A401EB0CAC200EFF210 /* OpenVPNServerEntry.h in Headers */,
C98467AB1EAA5BE100272A9A /* OpenVPNConfiguration+Internal.h in Headers */,
C98467A61EAA5B7700272A9A /* OpenVPNConfiguration.h in Headers */,
C9B7956B1F1D26C900CF35FE /* OpenVPNReachability+Internal.h in Headers */,
ABD6EF101F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.h in Headers */,
C9657A2B1EB0B6FA00EFF210 /* OpenVPNTransportStats+Internal.h in Headers */,
C9BB47601E71663A00F3F98C /* Umbrella-Header.h in Headers */,
C9657A5E1EB0D60700EFF210 /* OpenVPNTransportProtocol.h in Headers */,
@@ -579,16 +607,17 @@
C9B7955E1F1D16AA00CF35FE /* OpenVPNReachability.h in Headers */,
C915F1F41F612F3300B3DF23 /* OpenVPNPrivateKey.h in Headers */,
C9657A171EB0A7F800EFF210 /* OpenVPNConnectionInfo.h in Headers */,
C9BB47811E7173C700F3F98C /* OpenVPNAdapter+Public.h in Headers */,
C9BB47711E7171A100F3F98C /* OpenVPNError.h in Headers */,
C9B795641F1D182500CF35FE /* OpenVPNReachabilityTracker.h in Headers */,
C9BB47801E7173C700F3F98C /* OpenVPNAdapter+Internal.h in Headers */,
C9E4401D1F6086A1001D7C41 /* NSError+Message.h in Headers */,
ABD6EF091F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.h in Headers */,
C9657A611EB0D64E00EFF210 /* OpenVPNIPv6Preference.h in Headers */,
C9657A671EB0D73200EFF210 /* OpenVPNMinTLSVersion.h in Headers */,
C9C2B2BB200CC42A00CA0FF3 /* OpenVPNPacket.h in Headers */,
C93779D51EAE32670030A362 /* OpenVPNCredentials.h in Headers */,
C9657A641EB0D6C200EFF210 /* OpenVPNCompressionMode.h in Headers */,
C9FD921A1E9A667600374FC4 /* ovpncli.hpp in Headers */,
C9C2B2B7200CB42F00CA0FF3 /* OpenVPNAdapterPacketFlow.h in Headers */,
C9E350C1200F6EC0000820D9 /* NSError+OpenVPNError.h in Headers */,
C93779DB1EAE32880030A362 /* OpenVPNCredentials+Internal.h in Headers */,
C9657A6A1EB0D75700EFF210 /* OpenVPNTLSCertProfile.h in Headers */,
C9657A461EB0CB5900EFF210 /* OpenVPNServerEntry+Internal.h in Headers */,
@@ -601,22 +630,22 @@
buildActionMask = 2147483647;
files = (
C9CA4DD41F602F7B00C4F184 /* OpenVPNCertificate.h in Headers */,
C9D2ABE31EA20F99007EDF9D /* OpenVPNClient.h in Headers */,
C9CDFDDC200781AF00323B73 /* OpenVPNClient.h in Headers */,
C9657A3B1EB0BAAB00EFF210 /* OpenVPNInterfaceStats+Internal.h in Headers */,
C9354F461F1E4A4600F4C935 /* OpenVPNReachabilityStatus.h in Headers */,
C9BCE25F1EB3C201009D6AC1 /* OpenVPNSessionToken+Internal.h in Headers */,
C9D2ABE41EA20F99007EDF9D /* OpenVPNAdapterEvent.h in Headers */,
C9D2ABE51EA20F99007EDF9D /* OpenVPNAdapter.h in Headers */,
ABD6EF191F8F9C3B007D3D90 /* OpenVPNAdapter.h in Headers */,
C915F1FF1F6164CF00B3DF23 /* OpenVPNKeyType.h in Headers */,
C9657A4D1EB0CD6C00EFF210 /* OpenVPNProperties.h in Headers */,
C9657A561EB0CDFA00EFF210 /* OpenVPNProperties+Internal.h in Headers */,
C9BCE2591EB3C0D9009D6AC1 /* OpenVPNSessionToken.h in Headers */,
C9657A351EB0BA3900EFF210 /* OpenVPNInterfaceStats.h in Headers */,
C9BDB1361EBCC3B900C204FF /* OpenVPNTunnelSettings.h in Headers */,
C9657A411EB0CAC200EFF210 /* OpenVPNServerEntry.h in Headers */,
C98467AC1EAA5BE200272A9A /* OpenVPNConfiguration+Internal.h in Headers */,
C98467A71EAA5B7700272A9A /* OpenVPNConfiguration.h in Headers */,
C9B7956C1F1D26C900CF35FE /* OpenVPNReachability+Internal.h in Headers */,
ABD6EF111F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.h in Headers */,
C9657A2F1EB0B79500EFF210 /* OpenVPNTransportStats+Internal.h in Headers */,
C9D2ABE61EA20F99007EDF9D /* Umbrella-Header.h in Headers */,
C9657A5F1EB0D60700EFF210 /* OpenVPNTransportProtocol.h in Headers */,
@@ -624,16 +653,17 @@
C9B7955F1F1D16AA00CF35FE /* OpenVPNReachability.h in Headers */,
C915F1F51F612F3300B3DF23 /* OpenVPNPrivateKey.h in Headers */,
C9657A181EB0A7F800EFF210 /* OpenVPNConnectionInfo.h in Headers */,
C9D2ABE71EA20F99007EDF9D /* OpenVPNAdapter+Public.h in Headers */,
C9D2ABE81EA20F99007EDF9D /* OpenVPNError.h in Headers */,
C9B795651F1D182500CF35FE /* OpenVPNReachabilityTracker.h in Headers */,
C9D2ABE91EA20F99007EDF9D /* OpenVPNAdapter+Internal.h in Headers */,
C9E4401E1F6086A1001D7C41 /* NSError+Message.h in Headers */,
ABD6EF0A1F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.h in Headers */,
C9657A621EB0D64E00EFF210 /* OpenVPNIPv6Preference.h in Headers */,
C9657A681EB0D73200EFF210 /* OpenVPNMinTLSVersion.h in Headers */,
C9C2B2BC200CC42A00CA0FF3 /* OpenVPNPacket.h in Headers */,
C93779D61EAE32670030A362 /* OpenVPNCredentials.h in Headers */,
C9657A651EB0D6C200EFF210 /* OpenVPNCompressionMode.h in Headers */,
C9D2ABEA1EA20F99007EDF9D /* ovpncli.hpp in Headers */,
C9C2B2B8200CB42F00CA0FF3 /* OpenVPNAdapterPacketFlow.h in Headers */,
C9E350C2200F6EC0000820D9 /* NSError+OpenVPNError.h in Headers */,
C93779DC1EAE32880030A362 /* OpenVPNCredentials+Internal.h in Headers */,
C9657A6B1EB0D75700EFF210 /* OpenVPNTLSCertProfile.h in Headers */,
C9657A471EB0CB5900EFF210 /* OpenVPNServerEntry+Internal.h in Headers */,
@@ -783,6 +813,7 @@
C98467A21EAA559B00272A9A /* local_vpn_server.ovpn in Resources */,
C915F2221F61B0E700B3DF23 /* keyfile-decrypted.3des in Resources */,
C915F2251F61B22300B3DF23 /* test-ca.crt in Resources */,
C9C1E4101FA47117006ECA7D /* remote_vpn_server.ovpn in Resources */,
C915F21F1F6199E300B3DF23 /* keyfile-encrypted.3des in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -801,6 +832,7 @@
C98467A31EAA559B00272A9A /* local_vpn_server.ovpn in Resources */,
C915F2231F61B0E700B3DF23 /* keyfile-decrypted.3des in Resources */,
C915F2261F61B22300B3DF23 /* test-ca.crt in Resources */,
C9C1E4111FA47117006ECA7D /* remote_vpn_server.ovpn in Resources */,
C915F2201F6199E300B3DF23 /* keyfile-encrypted.3des in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -843,21 +875,23 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ABD6EF181F8F9C38007D3D90 /* OpenVPNAdapter.mm in Sources */,
C9657A421EB0CAC200EFF210 /* OpenVPNServerEntry.mm in Sources */,
C9BCE25A1EB3C0D9009D6AC1 /* OpenVPNSessionToken.mm in Sources */,
C9BB47821E7173C700F3F98C /* OpenVPNAdapter.mm in Sources */,
C9E350C3200F6EC0000820D9 /* NSError+OpenVPNError.m in Sources */,
ABD6EF0B1F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.m in Sources */,
C98467A81EAA5B7700272A9A /* OpenVPNConfiguration.mm in Sources */,
C9E4401F1F6086A1001D7C41 /* NSError+Message.m in Sources */,
C9BDB1371EBCC3B900C204FF /* OpenVPNTunnelSettings.m in Sources */,
ABD6EF121F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.mm in Sources */,
C9657A311EB0B7A900EFF210 /* OpenVPNTransportStats.mm in Sources */,
C9B795661F1D182500CF35FE /* OpenVPNReachabilityTracker.mm in Sources */,
C9657A581EB0CE1300EFF210 /* OpenVPNProperties.mm in Sources */,
C9CA4DD51F602F7B00C4F184 /* OpenVPNCertificate.m in Sources */,
C9CDFDDD200781AF00323B73 /* OpenVPNClient.mm in Sources */,
C915F1F61F612F3300B3DF23 /* OpenVPNPrivateKey.m in Sources */,
C9BB477A1E7171ED00F3F98C /* OpenVPNClient.mm in Sources */,
C9FD921B1E9A667600374FC4 /* ovpncli.cpp in Sources */,
C9657A361EB0BA3900EFF210 /* OpenVPNInterfaceStats.mm in Sources */,
C9657A211EB0ACAE00EFF210 /* OpenVPNConnectionInfo.mm in Sources */,
C9C2B2BD200CC42A00CA0FF3 /* OpenVPNPacket.mm in Sources */,
C93A4F621EE18009004DC561 /* OpenVPNError.m in Sources */,
C93779D71EAE32670030A362 /* OpenVPNCredentials.mm in Sources */,
C9B795601F1D16AA00CF35FE /* OpenVPNReachability.mm in Sources */,
@@ -868,6 +902,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C9C1E4141FA475B7006ECA7D /* CustomFlow.swift in Sources */,
C94605E91EAA656B00971516 /* OpenVPNConfigurationTests.swift in Sources */,
C9BB47911E71821A00F3F98C /* OpenVPNAdapterTests.swift in Sources */,
C915F1F91F615BB400B3DF23 /* OpenVPNPrivateKeyTests.swift in Sources */,
@@ -881,21 +916,23 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ABD6EF1A1F8F9C3B007D3D90 /* OpenVPNAdapter.mm in Sources */,
C9657A431EB0CAC200EFF210 /* OpenVPNServerEntry.mm in Sources */,
C9BCE25B1EB3C0D9009D6AC1 /* OpenVPNSessionToken.mm in Sources */,
C9D2ABDB1EA20F99007EDF9D /* OpenVPNAdapter.mm in Sources */,
C9E350C4200F6EC0000820D9 /* NSError+OpenVPNError.m in Sources */,
ABD6EF0C1F8F8CCD007D3D90 /* OpenVPNNetworkSettingsBuilder.m in Sources */,
C98467A91EAA5B7700272A9A /* OpenVPNConfiguration.mm in Sources */,
C9E440201F6086A1001D7C41 /* NSError+Message.m in Sources */,
C9BDB1381EBCC3B900C204FF /* OpenVPNTunnelSettings.m in Sources */,
ABD6EF131F8F93AB007D3D90 /* OpenVPNPacketFlowBridge.mm in Sources */,
C9657A301EB0B7A600EFF210 /* OpenVPNTransportStats.mm in Sources */,
C9B795671F1D182500CF35FE /* OpenVPNReachabilityTracker.mm in Sources */,
C9657A591EB0CE1400EFF210 /* OpenVPNProperties.mm in Sources */,
C9CA4DD61F602F7B00C4F184 /* OpenVPNCertificate.m in Sources */,
C9CDFDDE200781AF00323B73 /* OpenVPNClient.mm in Sources */,
C915F1F71F612F3300B3DF23 /* OpenVPNPrivateKey.m in Sources */,
C9D2ABDC1EA20F99007EDF9D /* OpenVPNClient.mm in Sources */,
C9D2ABDE1EA20F99007EDF9D /* ovpncli.cpp in Sources */,
C9657A371EB0BA3900EFF210 /* OpenVPNInterfaceStats.mm in Sources */,
C9657A221EB0ACAE00EFF210 /* OpenVPNConnectionInfo.mm in Sources */,
C9C2B2BE200CC42A00CA0FF3 /* OpenVPNPacket.mm in Sources */,
C93A4F631EE18009004DC561 /* OpenVPNError.m in Sources */,
C93779D81EAE32670030A362 /* OpenVPNCredentials.mm in Sources */,
C9B795611F1D16AA00CF35FE /* OpenVPNReachability.mm in Sources */,
@@ -912,6 +949,7 @@
C9354F471F1E4AE200F4C935 /* OpenVPNReachabilityTests.swift in Sources */,
C915F1FA1F615BB400B3DF23 /* OpenVPNPrivateKeyTests.swift in Sources */,
C9B03A7D1EABA82300268B85 /* ProfileLoader.swift in Sources */,
C9C1E4151FA475B7006ECA7D /* CustomFlow.swift in Sources */,
C9D2ABF71EA212A3007EDF9D /* Bundle.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -1341,7 +1379,6 @@
SUPPORTED_PLATFORMS = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Debug;
@@ -1388,7 +1425,6 @@
SDKROOT = macosx;
SUPPORTED_PLATFORMS = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
VALIDATE_PRODUCT = YES;
};

View File

@@ -1,15 +0,0 @@
//
// NSError+Message.h
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 06.09.17.
//
//
#import <Foundation/Foundation.h>
@interface NSError (Message)
+ (NSString *)reasonFromResult:(NSInteger)result;
@end

View File

@@ -1,28 +0,0 @@
//
// NSError+Message.m
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 06.09.17.
//
//
#import <mbedtls/error.h>
#import "NSError+Message.h"
@implementation NSError (Message)
+ (NSString *)reasonFromResult:(NSInteger)result {
size_t length = 1024;
char *buffer = malloc(length);
mbedtls_strerror(result, buffer, length);
NSString *reason = [NSString stringWithUTF8String:buffer];
free(buffer);
return reason;
}
@end

View File

@@ -0,0 +1,33 @@
//
// NSError+OpenVPNError.h
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 17.01.2018.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXPORT NSString *const OpenVPNAdapterErrorDomain;
typedef NS_ERROR_ENUM(OpenVPNAdapterErrorDomain, OpenVPNAdapterError);
@interface NSError (OpenVPNAdapterErrorGeneration)
+ (NSError *)ovpn_errorObjectForAdapterError:(OpenVPNAdapterError)adapterError
description:(NSString *)description
message:(nullable NSString *)message
fatal:(BOOL)fatal;
+ (OpenVPNAdapterError)ovpn_adapterErrorByName:(NSString *)errorName;
@end
@interface NSError (OpenVPNMbedTLSErrorGeneration)
+ (NSError *)ovpn_errorObjectForMbedTLSError:(NSInteger)errorCode description:(NSString *)description;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,203 @@
//
// NSError+OpenVPNError.m
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 17.01.2018.
//
#import "NSError+OpenVPNError.h"
#import <mbedtls/error.h>
#import "OpenVPNError.h"
@implementation NSError (OpenVPNAdapterErrorGeneration)
+ (NSError *)ovpn_errorObjectForAdapterError:(OpenVPNAdapterError)adapterError
description:(NSString *)description
message:(NSString *)message
fatal:(BOOL)fatal
{
NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] initWithDictionary:@{
NSLocalizedDescriptionKey: description,
OpenVPNAdapterErrorFatalKey: @(fatal)
}];
NSString *errorReason = [NSError ovpn_reasonForAdapterError:adapterError];
if (errorReason) {
userInfo[NSLocalizedFailureReasonErrorKey] = errorReason;
}
if (message.length) {
userInfo[OpenVPNAdapterErrorMessageKey] = message;
}
return [NSError errorWithDomain:OpenVPNAdapterErrorDomain code:adapterError userInfo:userInfo];
}
+ (OpenVPNAdapterError)ovpn_adapterErrorByName:(NSString *)errorName {
NSDictionary *errors = @{
@"NETWORK_RECV_ERROR": @(OpenVPNAdapterErrorNetworkRecvError),
@"NETWORK_EOF_ERROR": @(OpenVPNAdapterErrorNetworkEOFError),
@"NETWORK_SEND_ERROR": @(OpenVPNAdapterErrorNetworkSendError),
@"NETWORK_UNAVAILABLE": @(OpenVPNAdapterErrorNetworkUnavailable),
@"DECRYPT_ERROR": @(OpenVPNAdapterErrorDecryptError),
@"HMAC_ERROR": @(OpenVPNAdapterErrorDecryptError),
@"REPLAY_ERROR": @(OpenVPNAdapterErrorReplayError),
@"BUFFER_ERROR": @(OpenVPNAdapterErrorBufferError),
@"CC_ERROR": @(OpenVPNAdapterErrorCCError),
@"BAD_SRC_ADDR": @(OpenVPNAdapterErrorBadSrcAddr),
@"COMPRESS_ERROR": @(OpenVPNAdapterErrorCompressError),
@"RESOLVE_ERROR": @(OpenVPNAdapterErrorResolveError),
@"SOCKET_PROTECT_ERROR": @(OpenVPNAdapterErrorSocketProtectError),
@"TUN_READ_ERROR": @(OpenVPNAdapterErrorTUNReadError),
@"TUN_WRITE_ERROR": @(OpenVPNAdapterErrorTUNWriteError),
@"TUN_FRAMING_ERROR": @(OpenVPNAdapterErrorTUNFramingError),
@"TUN_SETUP_FAILED": @(OpenVPNAdapterErrorTUNSetupFailed),
@"TUN_IFACE_CREATE": @(OpenVPNAdapterErrorTUNIfaceCreate),
@"TUN_IFACE_DISABLED": @(OpenVPNAdapterErrorTUNIfaceDisabled),
@"TUN_ERROR": @(OpenVPNAdapterErrorTUNError),
@"TAP_NOT_SUPPORTED": @(OpenVPNAdapterErrorTAPNotSupported),
@"REROUTE_GW_NO_DNS": @(OpenVPNAdapterErrorRerouteGatewayNoDns),
@"TRANSPORT_ERROR": @(OpenVPNAdapterErrorTransportError),
@"TCP_OVERFLOW": @(OpenVPNAdapterErrorTCPOverflow),
@"TCP_SIZE_ERROR": @(OpenVPNAdapterErrorTCPSizeError),
@"TCP_CONNECT_ERROR": @(OpenVPNAdapterErrorTCPConnectError),
@"UDP_CONNECT_ERROR": @(OpenVPNAdapterErrorUDPConnectError),
@"SSL_ERROR": @(OpenVPNAdapterErrorSSLError),
@"SSL_PARTIAL_WRITE": @(OpenVPNAdapterErrorSSLPartialWrite),
@"ENCAPSULATION_ERROR": @(OpenVPNAdapterErrorEncapsulationError),
@"EPKI_CERT_ERROR": @(OpenVPNAdapterErrorEPKICertError),
@"EPKI_SIGN_ERROR": @(OpenVPNAdapterErrorEPKISignError),
@"HANDSHAKE_TIMEOUT": @(OpenVPNAdapterErrorHandshakeTimeout),
@"KEEPALIVE_TIMEOUT": @(OpenVPNAdapterErrorKeepaliveTimeout),
@"INACTIVE_TIMEOUT": @(OpenVPNAdapterErrorInactiveTimeout),
@"CONNECTION_TIMEOUT": @(OpenVPNAdapterErrorConnectionTimeout),
@"PRIMARY_EXPIRE": @(OpenVPNAdapterErrorPrimaryExpire),
@"TLS_VERSION_MIN": @(OpenVPNAdapterErrorTLSVersionMin),
@"TLS_AUTH_FAIL": @(OpenVPNAdapterErrorTLSAuthFail),
@"CERT_VERIFY_FAIL": @(OpenVPNAdapterErrorCertVerifyFail),
@"PEM_PASSWORD_FAIL": @(OpenVPNAdapterErrorPEMPasswordFail),
@"AUTH_FAILED": @(OpenVPNAdapterErrorAuthFailed),
@"CLIENT_HALT": @(OpenVPNAdapterErrorClientHalt),
@"CLIENT_RESTART": @(OpenVPNAdapterErrorClientRestart),
@"RELAY": @(OpenVPNAdapterErrorRelay),
@"RELAY_ERROR": @(OpenVPNAdapterErrorRelayError),
@"N_PAUSE": @(OpenVPNAdapterErrorPauseNumber),
@"N_RECONNECT": @(OpenVPNAdapterErrorReconnectNumber),
@"N_KEY_LIMIT_RENEG": @(OpenVPNAdapterErrorKeyLimitRenegNumber),
@"KEY_STATE_ERROR": @(OpenVPNAdapterErrorKeyStateError),
@"PROXY_ERROR": @(OpenVPNAdapterErrorProxyError),
@"PROXY_NEED_CREDS": @(OpenVPNAdapterErrorProxyNeedCreds),
@"KEV_NEGOTIATE_ERROR": @(OpenVPNAdapterErrorKevNegotiateError),
@"KEV_PENDING_ERROR": @(OpenVPNAdapterErrorKevPendingError),
@"N_KEV_EXPIRE": @(OpenVPNAdapterErrorKevExpireNumber),
@"PKTID_INVALID": @(OpenVPNAdapterErrorPKTIDInvalid),
@"PKTID_BACKTRACK": @(OpenVPNAdapterErrorPKTIDBacktrack),
@"PKTID_EXPIRE": @(OpenVPNAdapterErrorPKTIDExpire),
@"PKTID_REPLAY": @(OpenVPNAdapterErrorPKTIDReplay),
@"PKTID_TIME_BACKTRACK": @(OpenVPNAdapterErrorPKTIDTimeBacktrack),
@"DYNAMIC_CHALLENGE": @(OpenVPNAdapterErrorDynamicChallenge),
@"EPKI_ERROR": @(OpenVPNAdapterErrorEPKIError),
@"EPKI_INVALID_ALIAS": @(OpenVPNAdapterErrorEPKIInvalidAlias)
};
OpenVPNAdapterError error = errors[errorName] != nil ?
(OpenVPNAdapterError)[errors[errorName] integerValue] : OpenVPNAdapterErrorUnknown;
return error;
}
+ (NSString *)ovpn_reasonForAdapterError:(OpenVPNAdapterError)error {
switch (error) {
case OpenVPNAdapterErrorConfigurationFailure: return @"See OpenVPN error message for more details.";
case OpenVPNAdapterErrorCredentialsFailure: return @"See OpenVPN error message for more details.";
case OpenVPNAdapterErrorNetworkRecvError: return @"Errors receiving on network socket.";
case OpenVPNAdapterErrorNetworkEOFError: return @"EOF received on TCP network socket.";
case OpenVPNAdapterErrorNetworkSendError: return @"Errors sending on network socket";
case OpenVPNAdapterErrorNetworkUnavailable: return @"Network unavailable.";
case OpenVPNAdapterErrorDecryptError: return @"Data channel encrypt/decrypt error.";
case OpenVPNAdapterErrorHMACError: return @"HMAC verification failure.";
case OpenVPNAdapterErrorReplayError: return @"Error from PacketIDReceive.";
case OpenVPNAdapterErrorBufferError: return @"Exception thrown in Buffer methods.";
case OpenVPNAdapterErrorCCError: return @"General control channel errors.";
case OpenVPNAdapterErrorBadSrcAddr: return @"Packet from unknown source address.";
case OpenVPNAdapterErrorCompressError: return @"Compress/Decompress errors on data channel.";
case OpenVPNAdapterErrorResolveError: return @"DNS resolution error.";
case OpenVPNAdapterErrorSocketSetupFailed: return nil;
case OpenVPNAdapterErrorSocketProtectError: return @"Error calling protect() method on socket.";
case OpenVPNAdapterErrorTUNReadError: return @"Read errors on TUN/TAP interface.";
case OpenVPNAdapterErrorTUNWriteError: return @"Write errors on TUN/TAP interface.";
case OpenVPNAdapterErrorTUNFramingError: return @"Error with tun PF_INET/PF_INET6 prefix.";
case OpenVPNAdapterErrorTUNSetupFailed: return @"Error setting up TUN/TAP interface.";
case OpenVPNAdapterErrorTUNIfaceCreate: return @"Error creating TUN/TAP interface.";
case OpenVPNAdapterErrorTUNIfaceDisabled: return @"TUN/TAP interface is disabled.";
case OpenVPNAdapterErrorTUNError: return @"General tun error.";
case OpenVPNAdapterErrorTAPNotSupported: return @"Dev TAP is present in profile but not supported.";
case OpenVPNAdapterErrorRerouteGatewayNoDns: return @"redirect-gateway specified without alt DNS servers.";
case OpenVPNAdapterErrorTransportError: return @"General transport error";
case OpenVPNAdapterErrorTCPOverflow: return @"TCP output queue overflow.";
case OpenVPNAdapterErrorTCPSizeError: return @"Bad embedded uint16_t TCP packet size.";
case OpenVPNAdapterErrorTCPConnectError: return @"Client error on TCP connect.";
case OpenVPNAdapterErrorUDPConnectError: return @"Client error on UDP connect.";
case OpenVPNAdapterErrorSSLError: return @"Errors resulting from read/write on SSL object.";
case OpenVPNAdapterErrorSSLPartialWrite: return @"SSL object did not process all written cleartext.";
case OpenVPNAdapterErrorEncapsulationError: return @"Exceptions thrown during packet encapsulation.";
case OpenVPNAdapterErrorEPKICertError: return @"Error obtaining certificate from External PKI provider.";
case OpenVPNAdapterErrorEPKISignError: return @"Error obtaining RSA signature from External PKI provider.";
case OpenVPNAdapterErrorHandshakeTimeout: return @"Handshake failed to complete within given time frame.";
case OpenVPNAdapterErrorKeepaliveTimeout: return @"Lost contact with peer.";
case OpenVPNAdapterErrorInactiveTimeout: return @"Disconnected due to inactive timer.";
case OpenVPNAdapterErrorConnectionTimeout: return @"Connection failed to establish within given time.";
case OpenVPNAdapterErrorPrimaryExpire: return @"Primary key context expired.";
case OpenVPNAdapterErrorTLSVersionMin: return @"Peer cannot handshake at our minimum required TLS version.";
case OpenVPNAdapterErrorTLSAuthFail: return @"tls-auth HMAC verification failed.";
case OpenVPNAdapterErrorCertVerifyFail: return @"Peer certificate verification failure.";
case OpenVPNAdapterErrorPEMPasswordFail: return @"Incorrect or missing PEM private key decryption password.";
case OpenVPNAdapterErrorAuthFailed: return @"General authentication failure";
case OpenVPNAdapterErrorClientHalt: return @"HALT message from server received.";
case OpenVPNAdapterErrorClientRestart: return @"RESTART message from server received.";
case OpenVPNAdapterErrorRelay: return @"RELAY message from server received.";
case OpenVPNAdapterErrorRelayError: return @"RELAY error.";
case OpenVPNAdapterErrorPauseNumber: return nil;
case OpenVPNAdapterErrorReconnectNumber: return nil;
case OpenVPNAdapterErrorKeyLimitRenegNumber: return nil;
case OpenVPNAdapterErrorKeyStateError: return @"Received packet didn't match expected key state.";
case OpenVPNAdapterErrorProxyError: return @"HTTP proxy error.";
case OpenVPNAdapterErrorProxyNeedCreds: return @"HTTP proxy needs credentials.";
case OpenVPNAdapterErrorKevNegotiateError: return nil;
case OpenVPNAdapterErrorKevPendingError: return nil;
case OpenVPNAdapterErrorKevExpireNumber: return nil;
case OpenVPNAdapterErrorPKTIDInvalid: return nil;
case OpenVPNAdapterErrorPKTIDBacktrack: return nil;
case OpenVPNAdapterErrorPKTIDExpire: return nil;
case OpenVPNAdapterErrorPKTIDReplay: return nil;
case OpenVPNAdapterErrorPKTIDTimeBacktrack: return nil;
case OpenVPNAdapterErrorDynamicChallenge: return nil;
case OpenVPNAdapterErrorEPKIError: return nil;
case OpenVPNAdapterErrorEPKIInvalidAlias: return nil;
case OpenVPNAdapterErrorUnknown: return @"Unknown error.";
}
}
@end
@implementation NSError (OpenVPNMbedTLSErrorGeneration)
+ (NSError *)ovpn_errorObjectForMbedTLSError:(NSInteger)errorCode description:(NSString *)description {
size_t length = 1024;
char *buffer = malloc(length);
mbedtls_strerror(errorCode, buffer, length);
NSString *reason = [NSString stringWithUTF8String:buffer];
free(buffer);
return [NSError errorWithDomain:OpenVPNIdentityErrorDomain code:errorCode userInfo:@{
NSLocalizedDescriptionKey: description,
NSLocalizedFailureReasonErrorKey: reason
}];
}
@end

View File

@@ -1,40 +0,0 @@
//
// OpenVPNAdapter+Internal.h
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 11.02.17.
//
//
#import <client/ovpncli.hpp>
#import "OpenVPNAdapter.h"
using namespace openvpn;
@interface OpenVPNAdapter (Internal)
- (BOOL)configureSockets;
- (BOOL)setRemoteAddress:(NSString *)address isIPv6:(BOOL)isIPv6;
- (BOOL)addLocalAddress:(NSString *)address prefixLength:(NSNumber *)prefixLength gateway:(NSString *)gateway isIPv6:(BOOL)isIPv6;
- (BOOL)defaultGatewayRerouteIPv4:(BOOL)rerouteIPv4 rerouteIPv6:(BOOL)rerouteIPv6;
- (BOOL)addRoute:(NSString *)route prefixLength:(NSNumber *)prefixLength isIPv6:(BOOL)isIPv6;
- (BOOL)excludeRoute:(NSString *)route prefixLength:(NSNumber *)prefixLength isIPv6:(BOOL)isIPv6;
- (BOOL)addDNSAddress:(NSString *)address isIPv6:(BOOL)isIPv6;
- (BOOL)addSearchDomain:(NSString *)domain;
- (BOOL)setMTU:(NSNumber *)mtu;
- (CFSocketNativeHandle)establishTunnel;
- (void)teardownTunnel:(BOOL)disconnect;
- (void)handleEvent:(const ClientAPI::Event *)event;
- (void)handleLog:(const ClientAPI::LogInfo *)log;
- (void)tick;
@end

View File

@@ -1,191 +0,0 @@
//
// OpenVPNAdapter+Public.h
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 11.02.17.
//
//
#import "OpenVPNAdapterEvent.h"
#import "OpenVPNAdapter.h"
@class OpenVPNConfiguration;
@class OpenVPNProperties;
@class OpenVPNCredentials;
@class OpenVPNConnectionInfo;
@class OpenVPNSessionToken;
@class OpenVPNTransportStats;
@class OpenVPNInterfaceStats;
@class NEPacketTunnelNetworkSettings;
// TODO: Add documentation to properties and methods
/**
<#Description#>
*/
@protocol OpenVPNAdapterPacketFlow <NSObject>
/**
<#Description#>
@param completionHandler <#completionHandler description#>
*/
- (void)readPacketsWithCompletionHandler:(nonnull void (^)(NSArray<NSData *> * _Nonnull packets, NSArray<NSNumber *> * _Nonnull protocols))completionHandler;
/**
<#Description#>
@param packets <#packets description#>
@param protocols <#protocols description#>
@return <#return value description#>
*/
- (BOOL)writePackets:(nonnull NSArray<NSData *> *)packets withProtocols:(nonnull NSArray<NSNumber *> *)protocols;
@end
/**
<#Description#>
*/
@protocol OpenVPNAdapterDelegate <NSObject>
/**
<#Description#>
@param settings <#settings description#>
@param callback <#callback description#>
*/
- (void)configureTunnelWithSettings:(nonnull NEPacketTunnelNetworkSettings *)settings
callback:(nonnull void (^)(id<OpenVPNAdapterPacketFlow> _Nullable flow))callback
NS_SWIFT_NAME(configureTunnel(settings:callback:));
/**
<#Description#>
@param event <#event description#>
@param message <#message description#>
*/
- (void)handleEvent:(OpenVPNAdapterEvent)event
message:(nullable NSString *)message
NS_SWIFT_NAME(handle(event:message:));
/**
<#Description#>
@param error <#error description#>
*/
- (void)handleError:(nonnull NSError *)error
NS_SWIFT_NAME(handle(error:));
@optional
/**
<#Description#>
@param logMessage <#logMessage description#>
*/
- (void)handleLog:(nonnull NSString *)logMessage
NS_SWIFT_NAME(handle(logMessage:));
/**
<#Description#>
*/
- (void)tick;
@end
/**
<#Description#>
*/
@interface OpenVPNAdapter (Public)
/**
Return core copyright
*/
@property (class, nonnull, readonly, nonatomic) NSString *copyright;
/**
Return platform description
*/
@property (class, nonnull, readonly, nonatomic) NSString *platform;
/**
<#Description#>
*/
@property (weak, nonatomic, null_unspecified) id<OpenVPNAdapterDelegate> delegate;
/**
Return information about the most recent connection. Will be available
after an event of type "OpenVPNAdapterEventConnected, otherwise return nil.
*/
@property (nullable, readonly, nonatomic) OpenVPNConnectionInfo *connectionInfo;
/**
Return current session token or nil if session token is unavailable
*/
@property (nullable, readonly, nonatomic) OpenVPNSessionToken *sessionToken;
/**
Return transport stats
*/
@property (nonnull, readonly, nonatomic) OpenVPNTransportStats *transportStats;
/**
Return tun stats
*/
@property (nonnull, readonly, nonatomic) OpenVPNInterfaceStats *interfaceStats;
/**
<#Description#>
@param configuration <#configuration description#>
@param error <#error description#>
@return <#return value description#>
*/
- (nullable OpenVPNProperties *)applyConfiguration:(nonnull OpenVPNConfiguration *)configuration
error:(out NSError * __nullable * __nullable)error
NS_SWIFT_NAME(apply(configuration:));
/**
<#Description#>
@param credentials <#credentials description#>
@param error <#error description#>
@return <#return value description#>
*/
- (BOOL)provideCredentials:(nonnull OpenVPNCredentials *)credentials
error:(out NSError * __nullable * __nullable)error
NS_SWIFT_NAME(provide(credentials:));
/**
Establish connection with the VPN server
*/
- (void)connect;
/**
Pause the client - useful to avoid continuous reconnection attempts
when network is down
@param pauseReason <#reason description#>
*/
- (void)pauseWithReason:(nullable NSString *)pauseReason
NS_SWIFT_NAME(pause(reason:));
/**
Resume the client after it has been paused
*/
- (void)resume;
/**
Do a disconnect/reconnect cycle after given amount of seconds from now
@param interval <#interval description#>
*/
- (void)reconnectAfterTimeInterval:(NSInteger)interval
NS_SWIFT_NAME(reconnect(interval:));
/**
Close connection with the VPN server
*/
- (void)disconnect;
@end

View File

@@ -8,6 +8,174 @@
#import <Foundation/Foundation.h>
@interface OpenVPNAdapter : NSObject
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, OpenVPNAdapterEvent);
@class NEPacketTunnelFlow;
@class NEPacketTunnelNetworkSettings;
@protocol OpenVPNAdapterPacketFlow;
@class OpenVPNAdapter;
@class OpenVPNConfiguration;
@class OpenVPNConnectionInfo;
@class OpenVPNCredentials;
@class OpenVPNInterfaceStats;
@class OpenVPNProperties;
@class OpenVPNTransportStats;
@class OpenVPNSessionToken;
@protocol OpenVPNAdapterDelegate <NSObject>
/**
This method is called once the network settings to be used have been established.
The receiver should call the completion handler once these settings have been set, returning a NEPacketTunnelFlow object for
the TUN interface, or nil if an error occurred.
@param openVPNAdapter The OpenVPNAdapter instance requesting this information.
@param networkSettings The NEPacketTunnelNetworkSettings to be used for the tunnel.
@param completionHandler The completion handler to be called with a NEPacketTunnelFlow object, or nil if an error occurred.
*/
- (void)openVPNAdapter:(OpenVPNAdapter *)openVPNAdapter
configureTunnelWithNetworkSettings:(NEPacketTunnelNetworkSettings *)networkSettings
completionHandler:(void (^)(id<OpenVPNAdapterPacketFlow> _Nullable packetFlow))completionHandler
NS_SWIFT_NAME(openVPNAdapter(_:configureTunnelWithNetworkSettings:completionHandler:));
/**
Informs the receiver that an OpenVPN error has occurred.
Some errors are fatal and should trigger the diconnection of the tunnel, check for fatal errors with the
OpenVPNAdapterErrorFatalKey.
@param openVPNAdapter The OpenVPNAdapter instance which encountered the error.
@param error The error which has occurred.
*/
- (void)openVPNAdapter:(OpenVPNAdapter *)openVPNAdapter handleError:(NSError *)error;
/**
Informs the receiver that an OpenVPN event has occurred.
@param openVPNAdapter The OpenVPNAdapter instance which encountered the event.
@param event The event which has occurred.
@param message An accompanying message, may be nil.
*/
- (void)openVPNAdapter:(OpenVPNAdapter *)openVPNAdapter
handleEvent:(OpenVPNAdapterEvent)event
message:(nullable NSString *)message
NS_SWIFT_NAME(openVPNAdapter(_:handleEvent:message:));
@optional
/**
Informs the receiver that an OpenVPN message has been logged.
@param openVPNAdapter The OpenVPNAdapter instance which encountered the log message.
@param logMessage The log message.
*/
- (void)openVPNAdapter:(OpenVPNAdapter *)openVPNAdapter handleLogMessage:(NSString *)logMessage;
/**
Informs the receiver that a clock tick has occurred.
Clock ticks can be configured with an OpenVPNConfiguration object.
@param openVPNAdapter The OpenVPNAdapter instance which encountered the clock tick.
*/
- (void)openVPNAdapterDidReceiveClockTick:(OpenVPNAdapter *)openVPNAdapter;
@end
@interface OpenVPNAdapter : NSObject
/**
The OpenVPN core copyright message.
*/
@property (nonatomic, class, readonly) NSString *copyright;
/**
The OpenVPN platform.
*/
@property (nonatomic, class, readonly) NSString *platform;
/**
The object that acts as the delegate of the adapter.
*/
@property (nonatomic, weak) id<OpenVPNAdapterDelegate> delegate;
/**
The session name, nil unless the tunnel is connected.
*/
@property (nonatomic, nullable, readonly) NSString *sessionName;
/**
The connection information, nil unless the tunnel is connected.
*/
@property (nonatomic, nullable, readonly) OpenVPNConnectionInfo *connectionInformation;
/**
The interface statistics.
*/
@property (nonatomic, readonly) OpenVPNInterfaceStats *interfaceStatistics;
/**
The session token, nil unless the tunnel is connected.
*/
@property (nonatomic, nullable, readonly) OpenVPNSessionToken *sessionToken;
/**
The transport statistics.
*/
@property (nonatomic, readonly) OpenVPNTransportStats *transportStatistics;
/**
Applies the given configuration object.
Call this method prior to connecting, this method has no effect after calling connect.
@param configuration The configuration object.
@param error If there is an error applying the configuration, upon return contains an error object that describes the problem.
@return A properties object describing the configuration which has been applied.
*/
- (nullable OpenVPNProperties *)applyConfiguration:(OpenVPNConfiguration *)configuration
error:(NSError **)error
NS_SWIFT_NAME(apply(configuration:));
/**
Provides credentials to the receiver.
@param credentials The credentials object.
@param error If there is an error providing the credentials, upon return contains an error object that describes the problem.
@return Returns YES if this method was successful, otherwise NO.
*/
- (BOOL)provideCredentials:(OpenVPNCredentials *)credentials error:(NSError **)error NS_SWIFT_NAME(provide(credentials:));
/**
Starts the tunnel.
*/
- (void)connect;
/**
Pauses the tunnel.
@param reason The reason for pausing the tunnel.
*/
- (void)pauseWithReason:(NSString *)reason NS_SWIFT_NAME(pause(withReason:));
/**
Resumes the connection.
*/
- (void)resume;
/**
Reconnects after a given time period, perhaps due to an interface change.
@param timeInterval The time interval to wait before reconnecting.
*/
- (void)reconnectAfterTimeInterval:(NSTimeInterval)timeInterval NS_SWIFT_NAME(reconnect(afterTimeInterval:));
/**
Disconnect from the tunnel.
*/
- (void)disconnect;
@end
NS_ASSUME_NONNULL_END

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,39 @@
//
// OpenVPNAdapterPacketFlow.h
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 15.01.2018.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol OpenVPNAdapterPacketFlow <NSObject>
/**
Read IP packets from the TUN interface.
@param completionHandler A block that is executed when some packets are read from the TUN interface. The packets that were
read are passed to this block in the packets array. The protocol numbers of the packets that were read are passed to this
block in the protocols array. Each packet has a protocol number in the corresponding index in the protocols array. The
protocol numbers are given in host byte order. Valid protocol numbers include PF_INET and PF_INET6. See /usr/include/sys/socket.h.
*/
- (void)readPacketsWithCompletionHandler:(void (^)(NSArray<NSData *> *packets, NSArray<NSNumber *> *protocols))completionHandler;
/**
Write IP packets to the TUN interface
@param packets An array of NSData objects containing the IP packets to the written.
@param protocols An array of NSNumber objects containing the protocol numbers (e.g. PF_INET or PF_INET6) of the IP packets
in packets in host byte order.
@discussion The number of NSData objects in packets must be exactly equal to the number of NSNumber objects in protocols.
@return YES on success, otherwise NO.
*/
- (BOOL)writePackets:(NSArray<NSData *> *)packets withProtocols:(NSArray<NSNumber *> *)protocols;
@end
NS_ASSUME_NONNULL_END

View File

@@ -11,14 +11,14 @@
@interface OpenVPNCertificate : NSObject
+ (nullable OpenVPNCertificate *)certificateWithPEM:(nonnull NSData *)pemData
error:(out NSError * __nullable * __nullable)error;
error:(out NSError * _Nullable * _Nullable)error;
+ (nullable OpenVPNCertificate *)certificateWithDER:(nonnull NSData *)derData
error:(out NSError * __nullable * __nullable)error;
error:(out NSError * _Nullable * _Nullable)error;
- (nonnull instancetype) __unavailable init;
- (nonnull instancetype) init NS_UNAVAILABLE;
- (nullable NSData *)pemData:(out NSError * __nullable * __nullable)error;
- (nullable NSData *)derData:(out NSError * __nullable * __nullable)error;
- (nullable NSData *)pemData:(out NSError * _Nullable * _Nullable)error;
- (nullable NSData *)derData:(out NSError * _Nullable * _Nullable)error;
@end

View File

@@ -5,14 +5,13 @@
// Created by Sergey Abramchuk on 06.09.17.
//
//
#import <mbedtls/x509_crt.h>
#import <mbedtls/pem.h>
#import "NSError+Message.h"
#import "OpenVPNError.h"
#import "OpenVPNCertificate.h"
#include <mbedtls/x509_crt.h>
#include <mbedtls/pem.h>
#import "NSError+OpenVPNError.h"
@interface OpenVPNCertificate ()
@property (nonatomic, assign) mbedtls_x509_crt *crt;
@@ -21,16 +20,6 @@
@implementation OpenVPNCertificate
- (instancetype)init
{
self = [super init];
if (self) {
self.crt = malloc(sizeof(mbedtls_x509_crt));
mbedtls_x509_crt_init(self.crt);
}
return self;
}
+ (OpenVPNCertificate *)certificateWithPEM:(NSData *)pemData error:(out NSError **)error {
OpenVPNCertificate *certificate = [OpenVPNCertificate new];
@@ -39,11 +28,7 @@
int result = mbedtls_x509_crt_parse(certificate.crt, (const unsigned char *)pemString.UTF8String, pemData.length + 1);
if (result < 0) {
if (error) {
NSString *reason = [NSError reasonFromResult:result];
*error = [NSError errorWithDomain:OpenVPNIdentityErrorDomain code:result userInfo:@{
NSLocalizedDescriptionKey: @"Failed to read PEM data.",
NSLocalizedFailureReasonErrorKey: reason
}];
*error = [NSError ovpn_errorObjectForMbedTLSError:result description:@"Failed to read PEM data"];
}
return nil;
@@ -58,11 +43,7 @@
int result = mbedtls_x509_crt_parse_der(certificate.crt, derData.bytes, derData.length);
if (result < 0) {
if (error) {
NSString *reason = [NSError reasonFromResult:result];
*error = [NSError errorWithDomain:OpenVPNIdentityErrorDomain code:result userInfo:@{
NSLocalizedDescriptionKey: @"Failed to read DER data.",
NSLocalizedFailureReasonErrorKey: reason
}];
*error = [NSError ovpn_errorObjectForMbedTLSError:result description:@"Failed to read DER data"];
}
return nil;
@@ -71,6 +52,15 @@
return certificate;
}
- (instancetype)init
{
if (self = [super init]) {
_crt = malloc(sizeof(mbedtls_x509_crt));
mbedtls_x509_crt_init(_crt);
}
return self;
}
- (NSData *)pemData:(out NSError **)error {
NSString *header = @"-----BEGIN CERTIFICATE-----\n";
NSString *footer = @"-----END CERTIFICATE-----\n";
@@ -80,14 +70,11 @@
size_t output_length = 0;
int result = mbedtls_pem_write_buffer(header.UTF8String, footer.UTF8String, self.crt->raw.p, self.crt->raw.len, pem_buffer, buffer_length, &output_length);
int result = mbedtls_pem_write_buffer(header.UTF8String, footer.UTF8String, self.crt->raw.p,
self.crt->raw.len, pem_buffer, buffer_length, &output_length);
if (result < 0) {
if (error) {
NSString *reason = [NSError reasonFromResult:result];
*error = [NSError errorWithDomain:OpenVPNIdentityErrorDomain code:result userInfo:@{
NSLocalizedDescriptionKey: @"Failed to write PEM data.",
NSLocalizedFailureReasonErrorKey: reason
}];
*error = [NSError ovpn_errorObjectForMbedTLSError:result description: @"Failed to write PEM data"];
}
free(pem_buffer);
@@ -103,11 +90,8 @@
- (NSData *)derData:(out NSError **)error {
if (self.crt->raw.p == NULL || self.crt->raw.len == 0) {
if (error) {
NSString *reason = [NSError reasonFromResult:MBEDTLS_ERR_X509_BAD_INPUT_DATA];
*error = [NSError errorWithDomain:OpenVPNIdentityErrorDomain code:MBEDTLS_ERR_X509_BAD_INPUT_DATA userInfo:@{
NSLocalizedDescriptionKey: @"Failed to write DER data.",
NSLocalizedFailureReasonErrorKey:reason
}];
*error = [NSError ovpn_errorObjectForMbedTLSError:MBEDTLS_ERR_X509_BAD_INPUT_DATA
description: @"Failed to write DER data"];
}
return nil;
@@ -117,8 +101,8 @@
}
- (void)dealloc {
mbedtls_x509_crt_free(self.crt);
free(self.crt);
mbedtls_x509_crt_free(_crt);
free(_crt);
}
@end

View File

@@ -2,68 +2,100 @@
// OpenVPNClient.h
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 11.02.17.
//
// Created by Sergey Abramchuk on 11.01.2018.
//
#import <openvpn/tun/client/tunbase.hpp>
#import <client/ovpncli.hpp>
#import <Foundation/Foundation.h>
#include <client/ovpncli.hpp>
@class NEIPv4Route;
@class NEIPv6Route;
@class NEProxyServer;
typedef NS_ENUM(NSInteger, OpenVPNProxyServerProtocol) {
OpenVPNProxyServerProtocolHTTP,
OpenVPNProxyServerProtocolHTTPS
};
NS_ASSUME_NONNULL_BEGIN
@protocol OpenVPNClientDelegate <NSObject>
- (BOOL)setRemoteAddress:(NSString *)address;
- (BOOL)addIPV4Address:(NSString *)address subnetMask:(NSString *)subnetMask gateway:(nullable NSString *)gateway;
- (BOOL)addIPV6Address:(NSString *)address prefixLength:(NSNumber *)prefixLength gateway:(nullable NSString *)gateway;
- (BOOL)addIPV4Route:(NEIPv4Route *)route;
- (BOOL)addIPV6Route:(NEIPv6Route *)route;
- (BOOL)excludeIPV4Route:(NEIPv4Route *)route;
- (BOOL)excludeIPV6Route:(NEIPv6Route *)route;
- (BOOL)addDNS:(NSString *)dns;
- (BOOL)addSearchDomain:(NSString *)domain;
- (BOOL)setMTU:(NSNumber *)mtu;
- (BOOL)setSessionName:(NSString *)name;
- (BOOL)addProxyBypassHost:(NSString *)bypassHost;
- (BOOL)setProxyAutoConfigurationURL:(NSURL *)url;
- (BOOL)setProxyServer:(NEProxyServer *)server protocol:(OpenVPNProxyServerProtocol)protocol;
- (BOOL)establishTunnel;
- (CFSocketNativeHandle)socketHandle;
- (void)clientEventName:(NSString *)eventName message:(nullable NSString *)message;
- (void)clientErrorName:(NSString *)errorName fatal:(BOOL)fatal message:(nullable NSString *)message;
- (void)clientLogMessage:(NSString *)logMessage;
- (void)tick;
- (void)resetSettings;
@end
NS_ASSUME_NONNULL_END
using namespace openvpn;
class OpenVPNClient : public ClientAPI::OpenVPNClient
{
class OpenVPNClient : public ClientAPI::OpenVPNClient {
public:
OpenVPNClient(void * adapter);
OpenVPNClient(id<OpenVPNClientDelegate> _Nonnull delegate);
virtual bool tun_builder_new() override;
bool tun_builder_new() override;
virtual bool tun_builder_set_remote_address(const std::string& address, bool ipv6) override;
virtual bool tun_builder_add_address(const std::string& address,
int prefix_length,
const std::string& gateway,
bool ipv6,
bool net30) override;
virtual bool tun_builder_reroute_gw(bool ipv4,
bool ipv6,
unsigned int flags) override;
virtual bool tun_builder_add_route(const std::string& address,
int prefix_length,
int metric,
bool ipv6) override;
virtual bool tun_builder_exclude_route(const std::string& address,
int prefix_length,
int metric,
bool ipv6) override;
virtual bool tun_builder_add_dns_server(const std::string& address, bool ipv6) override;
virtual bool tun_builder_add_search_domain(const std::string& domain) override;
virtual bool tun_builder_set_mtu(int mtu) override;
virtual bool tun_builder_set_session_name(const std::string& name) override;
virtual bool tun_builder_add_proxy_bypass(const std::string& bypass_host) override;
virtual bool tun_builder_set_proxy_auto_config_url(const std::string& url) override;
virtual bool tun_builder_set_proxy_http(const std::string& host, int port) override;
virtual bool tun_builder_set_proxy_https(const std::string& host, int port) override;
virtual bool tun_builder_add_wins_server(const std::string& address) override;
bool tun_builder_set_remote_address(const std::string& address, bool ipv6) override;
bool tun_builder_add_address(const std::string& address, int prefix_length, const std::string& gateway,
bool ipv6, bool net30) override;
bool tun_builder_reroute_gw(bool ipv4, bool ipv6, unsigned int flags) override;
bool tun_builder_add_route(const std::string& address, int prefix_length, int metric, bool ipv6) override;
bool tun_builder_exclude_route(const std::string& address, int prefix_length, int metric, bool ipv6) override;
bool tun_builder_add_dns_server(const std::string& address, bool ipv6) override;
bool tun_builder_add_search_domain(const std::string& domain) override;
bool tun_builder_set_mtu(int mtu) override;
bool tun_builder_set_session_name(const std::string& name) override;
bool tun_builder_add_proxy_bypass(const std::string& bypass_host) override;
bool tun_builder_set_proxy_auto_config_url(const std::string& urlString) override;
bool tun_builder_set_proxy_http(const std::string& host, int port) override;
bool tun_builder_set_proxy_https(const std::string& host, int port) override;
bool tun_builder_set_block_ipv6(bool block_ipv6) override;
virtual int tun_builder_establish() override;
int tun_builder_establish() override;
bool tun_builder_persist() override;
void tun_builder_teardown(bool disconnect) override;
virtual bool tun_builder_persist() override;
virtual void tun_builder_establish_lite() override;
bool socket_protect(int socket) override;
bool pause_on_connection_timeout() override;
virtual void tun_builder_teardown(bool disconnect) override;
void external_pki_cert_request(ClientAPI::ExternalPKICertRequest& certreq) override;
void external_pki_sign_request(ClientAPI::ExternalPKISignRequest& signreq) override;
virtual bool socket_protect(int socket) override;
void event(const ClientAPI::Event& event) override;
void log(const ClientAPI::LogInfo& log) override;
virtual bool pause_on_connection_timeout() override;
virtual void external_pki_cert_request(ClientAPI::ExternalPKICertRequest& certreq) override;
virtual void external_pki_sign_request(ClientAPI::ExternalPKISignRequest& signreq) override;
virtual void event(const ClientAPI::Event& ev) override;
virtual void log(const ClientAPI::LogInfo& log) override;
virtual void clock_tick() override;
void clock_tick() override;
private:
void* adapter;
__weak id<OpenVPNClientDelegate> _Nonnull delegate;
};

View File

@@ -2,99 +2,143 @@
// OpenVPNClient.m
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 11.02.17.
//
// Created by Sergey Abramchuk on 11.01.2018.
//
#import <Foundation/Foundation.h>
#define INVALID_SOCKET -1
#import "OpenVPNAdapter+Internal.h"
#import "OpenVPNClient.h"
OpenVPNClient::OpenVPNClient(void *adapter) : ClientAPI::OpenVPNClient() {
this->adapter = adapter;
#import <NetworkExtension/NetworkExtension.h>
#include <openvpn/addr/ipv4.hpp>
using ::IPv4::Addr;
OpenVPNClient::OpenVPNClient(id<OpenVPNClientDelegate> delegate): ClientAPI::OpenVPNClient() {
this->delegate = delegate;
}
bool OpenVPNClient::tun_builder_new() {
return [(__bridge OpenVPNAdapter *)adapter configureSockets];
[this->delegate resetSettings];
return true;
}
bool OpenVPNClient::tun_builder_set_remote_address(const std::string &address, bool ipv6) {
NSString *remoteAddress = [NSString stringWithUTF8String:address.c_str()];
return [(__bridge OpenVPNAdapter *)adapter setRemoteAddress:remoteAddress isIPv6:ipv6];
return [this->delegate setRemoteAddress:remoteAddress];
}
bool OpenVPNClient::tun_builder_add_address(const std::string &address, int prefix_length, const std::string &gateway, bool ipv6, bool net30) {
NSString *localAddress = [NSString stringWithUTF8String:address.c_str()];
NSString *gatewayAddress = [NSString stringWithUTF8String:gateway.c_str()];
NSString *gatewayAddress = gateway.length() == 0 || gateway.compare("UNSPEC") == 0 ? nil :
[NSString stringWithUTF8String:gateway.c_str()];
return [(__bridge OpenVPNAdapter *)adapter addLocalAddress:localAddress prefixLength:@(prefix_length) gateway:gatewayAddress isIPv6:ipv6];
if (ipv6) {
return [this->delegate addIPV6Address:localAddress prefixLength:@(prefix_length) gateway:gatewayAddress];
} else {
NSString *subnetMask = [NSString stringWithUTF8String:Addr::netmask_from_prefix_len(prefix_length).to_string().c_str()];
return [this->delegate addIPV4Address:localAddress subnetMask:subnetMask gateway:gatewayAddress];
}
}
bool OpenVPNClient::tun_builder_reroute_gw(bool ipv4, bool ipv6, unsigned int flags) {
return [(__bridge OpenVPNAdapter *)adapter defaultGatewayRerouteIPv4:ipv4 rerouteIPv6:ipv6];
if (ipv4 && ![this->delegate addIPV4Route:[NEIPv4Route defaultRoute]]) {
return false;
}
if (ipv6 && ![this->delegate addIPV6Route:[NEIPv6Route defaultRoute]]) {
return false;
}
return true;
}
bool OpenVPNClient::tun_builder_add_route(const std::string& address, int prefix_length, int metric, bool ipv6) {
NSString *route = [NSString stringWithUTF8String:address.c_str()];
return [(__bridge OpenVPNAdapter *)adapter addRoute:route prefixLength:@(prefix_length) isIPv6:ipv6];
NSString *routeAddress = [NSString stringWithUTF8String:address.c_str()];
if (ipv6) {
NEIPv6Route *route = [[NEIPv6Route alloc] initWithDestinationAddress:routeAddress networkPrefixLength:@(prefix_length)];
return [this->delegate addIPV6Route:route];
} else {
NSString *subnetMask = [NSString stringWithUTF8String:Addr::netmask_from_prefix_len(prefix_length).to_string().c_str()];
NEIPv4Route *route = [[NEIPv4Route alloc] initWithDestinationAddress:routeAddress subnetMask:subnetMask];
return [this->delegate addIPV4Route:route];
}
}
bool OpenVPNClient::tun_builder_exclude_route(const std::string& address, int prefix_length, int metric, bool ipv6) {
NSString *route = [NSString stringWithUTF8String:address.c_str()];
return [(__bridge OpenVPNAdapter *)adapter excludeRoute:route prefixLength:@(prefix_length) isIPv6:ipv6];
NSString *routeAddress = [NSString stringWithUTF8String:address.c_str()];
if (ipv6) {
NEIPv6Route *route = [[NEIPv6Route alloc] initWithDestinationAddress:routeAddress networkPrefixLength:@(prefix_length)];
return [this->delegate excludeIPV6Route:route];
} else {
NSString *subnetMask = [NSString stringWithUTF8String:Addr::netmask_from_prefix_len(prefix_length).to_string().c_str()];
NEIPv4Route *route = [[NEIPv4Route alloc] initWithDestinationAddress:routeAddress subnetMask:subnetMask];
return [this->delegate excludeIPV4Route:route];
}
}
bool OpenVPNClient::tun_builder_add_dns_server(const std::string& address, bool ipv6) {
NSString *dnsAddress = [NSString stringWithUTF8String:address.c_str()];
return [(__bridge OpenVPNAdapter *)adapter addDNSAddress:dnsAddress isIPv6:ipv6];
NSString *dns = [NSString stringWithUTF8String:address.c_str()];
return [this->delegate addDNS:dns];
}
bool OpenVPNClient::tun_builder_add_search_domain(const std::string& domain) {
NSString *searchDomain = [NSString stringWithUTF8String:domain.c_str()];
return [(__bridge OpenVPNAdapter *)adapter addSearchDomain:searchDomain];
return [this->delegate addSearchDomain:searchDomain];
}
bool OpenVPNClient::tun_builder_set_mtu(int mtu) {
return [(__bridge OpenVPNAdapter *)adapter setMTU:@(mtu)];
return [this->delegate setMTU:@(mtu)];
}
bool OpenVPNClient::tun_builder_set_session_name(const std::string& name) {
return true;
NSString *sessionName = [NSString stringWithUTF8String:name.c_str()];
return [this->delegate setSessionName:sessionName];
}
bool OpenVPNClient::tun_builder_add_proxy_bypass(const std::string& bypass_host) {
return true;
NSString *bypassHost = [NSString stringWithUTF8String:bypass_host.c_str()];
return [this->delegate addProxyBypassHost:bypassHost];
}
bool OpenVPNClient::tun_builder_set_proxy_auto_config_url(const std::string& url) {
return true;
NSURL *configURL = [[NSURL alloc] initWithString:[NSString stringWithUTF8String:url.c_str()]];
if (configURL) {
return [this->delegate setProxyAutoConfigurationURL:configURL];
} else {
return false;
}
}
bool OpenVPNClient::tun_builder_set_proxy_http(const std::string& host, int port) {
return true;
NSString *proxyHost = [NSString stringWithUTF8String:host.c_str()];
NEProxyServer *proxyServer = [[NEProxyServer alloc] initWithAddress:proxyHost port:port];
return [this->delegate setProxyServer:proxyServer protocol:OpenVPNProxyServerProtocolHTTP];
}
bool OpenVPNClient::tun_builder_set_proxy_https(const std::string& host, int port) {
return true;
NSString *proxyHost = [NSString stringWithUTF8String:host.c_str()];
NEProxyServer *proxyServer = [[NEProxyServer alloc] initWithAddress:proxyHost port:port];
return [this->delegate setProxyServer:proxyServer protocol:OpenVPNProxyServerProtocolHTTPS];
}
bool OpenVPNClient::tun_builder_add_wins_server(const std::string& address) {
return true;
bool OpenVPNClient::tun_builder_set_block_ipv6(bool block_ipv6) {
return block_ipv6;
}
int OpenVPNClient::tun_builder_establish() {
return (int)[(__bridge OpenVPNAdapter *)adapter establishTunnel];
return [this->delegate establishTunnel] ? [this->delegate socketHandle] : INVALID_SOCKET;
}
bool OpenVPNClient::tun_builder_persist() {
return true;
}
void OpenVPNClient::tun_builder_establish_lite() { }
void OpenVPNClient::tun_builder_teardown(bool disconnect) {
[(__bridge OpenVPNAdapter *)adapter teardownTunnel:disconnect];
[this->delegate resetSettings];
}
bool OpenVPNClient::socket_protect(int socket) {
@@ -109,13 +153,21 @@ void OpenVPNClient::external_pki_cert_request(ClientAPI::ExternalPKICertRequest&
void OpenVPNClient::external_pki_sign_request(ClientAPI::ExternalPKISignRequest& signreq) { }
void OpenVPNClient::event(const ClientAPI::Event& ev) {
[(__bridge OpenVPNAdapter* )adapter handleEvent:&ev];
NSString *name = [NSString stringWithUTF8String:ev.name.c_str()];
NSString *message = [NSString stringWithUTF8String:ev.info.c_str()];
if (ev.error) {
[this->delegate clientErrorName:name fatal:ev.fatal message:message.length ? message : nil];
} else {
[this->delegate clientEventName:name message:message.length ? message : nil];
}
}
void OpenVPNClient::log(const ClientAPI::LogInfo& log) {
[(__bridge OpenVPNAdapter* )adapter handleLog:&log];
NSString *logMessage = [NSString stringWithUTF8String:log.text.c_str()];
[this->delegate clientLogMessage:logMessage];
}
void OpenVPNClient::clock_tick() {
[(__bridge OpenVPNAdapter* )adapter tick];
[this->delegate tick];
}

View File

@@ -6,29 +6,33 @@
//
//
#import <client/ovpncli.hpp>
#import "OpenVPNConfiguration.h"
#include <client/ovpncli.hpp>
using namespace openvpn;
NS_ASSUME_NONNULL_BEGIN
@interface OpenVPNConfiguration (Internal)
@property (readonly) ClientAPI::Config config;
+ (OpenVPNTransportProtocol)getTransportProtocolFromValue:(nullable NSString *)value;
+ (nonnull NSString *)getValueFromTransportProtocol:(OpenVPNTransportProtocol)protocol;
+ (NSString *)getValueFromTransportProtocol:(OpenVPNTransportProtocol)protocol;
+ (OpenVPNIPv6Preference)getIPv6PreferenceFromValue:(nullable NSString *)value;
+ (nonnull NSString *)getValueFromIPv6Preference:(OpenVPNIPv6Preference)preference;
+ (NSString *)getValueFromIPv6Preference:(OpenVPNIPv6Preference)preference;
+ (OpenVPNCompressionMode)getCompressionModeFromValue:(nullable NSString *)value;
+ (nonnull NSString *)getValueFromCompressionMode:(OpenVPNCompressionMode)compressionMode;
+ (NSString *)getValueFromCompressionMode:(OpenVPNCompressionMode)compressionMode;
+ (OpenVPNMinTLSVersion)getMinTLSFromValue:(nullable NSString *)value;
+ (nonnull NSString *)getValueFromMinTLS:(OpenVPNMinTLSVersion)minTLS;
+ (NSString *)getValueFromMinTLS:(OpenVPNMinTLSVersion)minTLS;
+ (OpenVPNTLSCertProfile)getTLSCertProfileFromValue:(nullable NSString *)value;
+ (nonnull NSString *)getValueFromTLSCertProfile:(OpenVPNTLSCertProfile)tlsCertProfile;
+ (NSString *)getValueFromTLSCertProfile:(OpenVPNTLSCertProfile)tlsCertProfile;
@end
NS_ASSUME_NONNULL_END

View File

@@ -8,11 +8,11 @@
#import <Foundation/Foundation.h>
#import "OpenVPNTransportProtocol.h"
#import "OpenVPNIPv6Preference.h"
#import "OpenVPNCompressionMode.h"
#import "OpenVPNMinTLSVersion.h"
#import "OpenVPNTLSCertProfile.h"
typedef NS_ENUM(NSInteger, OpenVPNTransportProtocol);
typedef NS_ENUM(NSInteger, OpenVPNIPv6Preference);
typedef NS_ENUM(NSInteger, OpenVPNCompressionMode);
typedef NS_ENUM(NSInteger, OpenVPNMinTLSVersion);
typedef NS_ENUM(NSInteger, OpenVPNTLSCertProfile);
/**
Class used to pass configuration

View File

@@ -6,8 +6,15 @@
//
//
#import "OpenVPNConfiguration.h"
#import "OpenVPNConfiguration+Internal.h"
#import "OpenVPNTransportProtocol.h"
#import "OpenVPNIPv6Preference.h"
#import "OpenVPNCompressionMode.h"
#import "OpenVPNMinTLSVersion.h"
#import "OpenVPNTLSCertProfile.h"
using namespace openvpn;
NSString *const OpenVPNTransportProtocolUDPValue = @"udp";
@@ -212,7 +219,7 @@ NSString *const OpenVPNTLSCertProfileDefaultValue = @"default";
}
- (void)setFileContent:(NSData *)fileContent {
_config.content = fileContent ? std::string((const char *)fileContent.bytes) : "";
_config.content = fileContent.length ? std::string((const char *)fileContent.bytes) : "";
}
- (NSDictionary<NSString *,NSString *> *)settings {
@@ -494,7 +501,7 @@ NSString *const OpenVPNTLSCertProfileDefaultValue = @"default";
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
if ((self = [self init])) {
if (self = [self init]) {
self.fileContent = [aDecoder decodeObjectOfClass:[NSData class] forKey:NSStringFromSelector(@selector(fileContent))];
self.settings = [aDecoder decodeObjectOfClass:[NSDictionary class] forKey:NSStringFromSelector(@selector(settings))];
self.guiVersion = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(guiVersion))];

View File

@@ -6,10 +6,10 @@
//
//
#import <client/ovpncli.hpp>
#import "OpenVPNConnectionInfo.h"
#include <client/ovpncli.hpp>
using namespace openvpn;
@interface OpenVPNConnectionInfo (Internal)

View File

@@ -28,7 +28,7 @@ using namespace openvpn;
@implementation OpenVPNConnectionInfo
- (instancetype)initWithConnectionInfo:(ClientAPI::ConnectionInfo)info {
if ((self = [super init])) {
if (self = [super init]) {
self.user = !info.user.empty() ? [NSString stringWithUTF8String:info.user.c_str()] : nil;
self.serverHost = !info.serverHost.empty() ? [NSString stringWithUTF8String:info.serverHost.c_str()] : nil;
self.serverPort = !info.serverPort.empty() ? [NSString stringWithUTF8String:info.serverPort.c_str()] : nil;
@@ -75,7 +75,7 @@ using namespace openvpn;
}
- (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder {
if ((self = [self init])) {
if (self = [self init]) {
self.user = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(user))];
self.serverHost = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(serverHost))];
self.serverPort = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(serverPort))];

View File

@@ -5,11 +5,10 @@
// Created by Sergey Abramchuk on 24.04.17.
//
//
#import <client/ovpncli.hpp>
#import "OpenVPNCredentials.h"
#include <client/ovpncli.hpp>
using namespace openvpn;
@interface OpenVPNCredentials (Internal)

View File

@@ -52,7 +52,8 @@ using namespace openvpn;
}
- (NSString *)dynamicChallengeCookie {
return !_credentials.dynamicChallengeCookie.empty() ? [NSString stringWithUTF8String:_credentials.dynamicChallengeCookie.c_str()] : nil;
return !_credentials.dynamicChallengeCookie.empty() ?
[NSString stringWithUTF8String:_credentials.dynamicChallengeCookie.c_str()] : nil;
}
- (void)setDynamicChallengeCookie:(NSString *)dynamicChallengeCookie {

View File

@@ -8,11 +8,15 @@
#import <Foundation/Foundation.h>
FOUNDATION_EXPORT NSString * __nonnull const OpenVPNAdapterErrorDomain;
FOUNDATION_EXPORT NSString * __nonnull const OpenVPNIdentityErrorDomain;
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXPORT NSString * __nonnull const OpenVPNAdapterErrorFatalKey;
FOUNDATION_EXPORT NSString * __nonnull const OpenVPNAdapterErrorMessageKey;
FOUNDATION_EXPORT NSString *const OpenVPNAdapterErrorDomain;
FOUNDATION_EXPORT NSString *const OpenVPNIdentityErrorDomain;
FOUNDATION_EXPORT NSString *const OpenVPNAdapterErrorFatalKey;
FOUNDATION_EXPORT NSString *const OpenVPNAdapterErrorMessageKey;
NS_ASSUME_NONNULL_END
/**
OpenVPN error codes
@@ -32,6 +36,7 @@ typedef NS_ERROR_ENUM(OpenVPNAdapterErrorDomain, OpenVPNAdapterError) {
OpenVPNAdapterErrorBadSrcAddr,
OpenVPNAdapterErrorCompressError,
OpenVPNAdapterErrorResolveError,
OpenVPNAdapterErrorSocketSetupFailed,
OpenVPNAdapterErrorSocketProtectError,
OpenVPNAdapterErrorTUNReadError,
OpenVPNAdapterErrorTUNWriteError,

View File

@@ -8,8 +8,8 @@
#import <OpenVPNError.h>
NSString * const OpenVPNAdapterErrorDomain = @"me.ss-abramchuk.openvpn-adapter.error-domain";
NSString * const OpenVPNIdentityErrorDomain = @"me.ss-abramchuk.openvpn-identity.error-domain";
NSString *const OpenVPNAdapterErrorDomain = @"me.ss-abramchuk.openvpn-adapter.error-domain";
NSString *const OpenVPNIdentityErrorDomain = @"me.ss-abramchuk.openvpn-identity.error-domain";
NSString * const OpenVPNAdapterErrorFatalKey = @"me.ss-abramchuk.openvpn-adapter.error-key.fatal";
NSString * const OpenVPNAdapterErrorMessageKey = @"me.ss-abramchuk.openvpn-adapter.error-key.message";
NSString *const OpenVPNAdapterErrorFatalKey = @"me.ss-abramchuk.openvpn-adapter.error-key.fatal";
NSString *const OpenVPNAdapterErrorMessageKey = @"me.ss-abramchuk.openvpn-adapter.error-key.message";

View File

@@ -6,10 +6,10 @@
//
//
#import <client/ovpncli.hpp>
#import "OpenVPNInterfaceStats.h"
#include <client/ovpncli.hpp>
using namespace openvpn;
@interface OpenVPNInterfaceStats (Internal)

View File

@@ -21,7 +21,7 @@
@implementation OpenVPNInterfaceStats
- (instancetype)initWithInterfaceStats:(ClientAPI::InterfaceStats)stats {
if ((self = [super init])) {
if (self = [super init]) {
self.bytesIn = stats.bytesIn;
self.bytesOut = stats.bytesOut;
self.packetsIn = stats.packetsIn;
@@ -53,7 +53,7 @@
}
- (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder {
if ((self = [self init])) {
if (self = [self init]) {
self.bytesIn = [aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(bytesIn))];
self.bytesOut = [aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(bytesOut))];
self.packetsIn = [aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(packetsIn))];

View File

@@ -0,0 +1,52 @@
//
// OpenVPNNetworkSettingsBuilder.h
// OpenVPN Adapter
//
// Created by Jonathan Downing on 12/10/2017.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class NEIPv4Route;
@class NEIPv6Route;
@class NEProxyServer;
@class NEPacketTunnelNetworkSettings;
@interface OpenVPNNetworkSettingsBuilder : NSObject
@property (nonatomic, copy, nullable) NSString *remoteAddress;
@property (nonatomic, copy, nullable) NSString *ipv4DefaultGateway;
@property (nonatomic, copy, nullable) NSString *ipv6DefaultGateway;
@property (nonatomic, copy, nullable) NSNumber *mtu;
@property (nonatomic, readonly) NSMutableArray<NSString *> *ipv4LocalAddresses;
@property (nonatomic, readonly) NSMutableArray<NSString *> *ipv4SubnetMasks;
@property (nonatomic, readonly) NSMutableArray<NEIPv4Route *> *ipv4IncludedRoutes;
@property (nonatomic, readonly) NSMutableArray<NEIPv4Route *> *ipv4ExcludedRoutes;
@property (nonatomic, readonly) NSMutableArray<NSString *> *ipv6LocalAddresses;
@property (nonatomic, readonly) NSMutableArray<NSNumber *> *ipv6NetworkPrefixLengths;
@property (nonatomic, readonly) NSMutableArray<NEIPv6Route *> *ipv6IncludedRoutes;
@property (nonatomic, readonly) NSMutableArray<NEIPv6Route *> *ipv6ExcludedRoutes;
@property (nonatomic, readonly) NSMutableArray<NSString *> *dnsServers;
@property (nonatomic, readonly) NSMutableArray<NSString *> *searchDomains;
@property (nonatomic, readonly) NSMutableArray<NSString *> *proxyExceptionList;
@property (nonatomic) BOOL autoProxyConfigurationEnabled;
@property (nonatomic, copy, nullable) NSURL *proxyAutoConfigurationURL;
@property (nonatomic) BOOL httpProxyServerEnabled;
@property (nonatomic, copy, nullable) NEProxyServer *httpProxyServer;
@property (nonatomic) BOOL httpsProxyServerEnabled;
@property (nonatomic, copy, nullable) NEProxyServer *httpsProxyServer;
- (nullable NEPacketTunnelNetworkSettings *)networkSettings;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,142 @@
//
// OpenVPNNetworkSettingsBuilder.m
// OpenVPN Adapter
//
// Created by Jonathan Downing on 12/10/2017.
//
#import "OpenVPNNetworkSettingsBuilder.h"
#import <NetworkExtension/NetworkExtension.h>
@interface OpenVPNNetworkSettingsBuilder ()
@property (nonatomic) NSMutableArray<NSString *> *ipv4LocalAddresses;
@property (nonatomic) NSMutableArray<NSString *> *ipv4SubnetMasks;
@property (nonatomic) NSMutableArray<NEIPv4Route *> *ipv4IncludedRoutes;
@property (nonatomic) NSMutableArray<NEIPv4Route *> *ipv4ExcludedRoutes;
@property (nonatomic) NSMutableArray<NSString *> *ipv6LocalAddresses;
@property (nonatomic) NSMutableArray<NSNumber *> *ipv6NetworkPrefixLengths;
@property (nonatomic) NSMutableArray<NEIPv6Route *> *ipv6IncludedRoutes;
@property (nonatomic) NSMutableArray<NEIPv6Route *> *ipv6ExcludedRoutes;
@property (nonatomic) NSMutableArray<NSString *> *dnsServers;
@property (nonatomic) NSMutableArray<NSString *> *searchDomains;
@property (nonatomic) NSMutableArray<NSString *> *proxyExceptionList;
@end
@implementation OpenVPNNetworkSettingsBuilder
#pragma mark - NEPacketTunnelNetworkSettings Generation
- (NEPacketTunnelNetworkSettings *)networkSettings {
if (!self.remoteAddress.length) { return nil; }
NEPacketTunnelNetworkSettings *networkSettings = [[NEPacketTunnelNetworkSettings alloc] initWithTunnelRemoteAddress:self.remoteAddress];
if (self.ipv4LocalAddresses.count && (self.ipv4LocalAddresses.count == self.ipv4SubnetMasks.count)) {
NEIPv4Settings *ipv4Settings = [[NEIPv4Settings alloc] initWithAddresses:self.ipv4LocalAddresses
subnetMasks:self.ipv4SubnetMasks];
ipv4Settings.includedRoutes = self.ipv4IncludedRoutes;
ipv4Settings.excludedRoutes = self.ipv4ExcludedRoutes;
networkSettings.IPv4Settings = ipv4Settings;
}
if (self.ipv6LocalAddresses.count && (self.ipv6LocalAddresses.count == self.ipv6NetworkPrefixLengths.count)) {
NEIPv6Settings *ipv6Settings = [[NEIPv6Settings alloc] initWithAddresses:self.ipv6LocalAddresses
networkPrefixLengths:self.ipv6NetworkPrefixLengths];
ipv6Settings.includedRoutes = self.ipv6IncludedRoutes;
ipv6Settings.excludedRoutes = self.ipv6ExcludedRoutes;
networkSettings.IPv6Settings = ipv6Settings;
}
if (self.dnsServers.count) {
NEDNSSettings *dnsSettings = [[NEDNSSettings alloc] initWithServers:self.dnsServers];
dnsSettings.searchDomains = self.searchDomains;
networkSettings.DNSSettings = dnsSettings;
}
if (self.autoProxyConfigurationEnabled || self.httpProxyServerEnabled || self.httpsProxyServerEnabled) {
NEProxySettings *proxySettings = [[NEProxySettings alloc] init];
proxySettings.autoProxyConfigurationEnabled = self.autoProxyConfigurationEnabled;
proxySettings.proxyAutoConfigurationURL = self.proxyAutoConfigurationURL;
proxySettings.exceptionList = self.proxyExceptionList;
proxySettings.HTTPServer = self.httpProxyServer;
proxySettings.HTTPEnabled = self.httpProxyServerEnabled;
proxySettings.HTTPSServer = self.httpsProxyServer;
proxySettings.HTTPSEnabled = self.httpsProxyServerEnabled;
networkSettings.proxySettings = proxySettings;
}
networkSettings.MTU = self.mtu;
return networkSettings;
}
#pragma mark - Lazy Initializers
- (NSMutableArray<NSString *> *)ipv4LocalAddresses {
if (!_ipv4LocalAddresses) { _ipv4LocalAddresses = [[NSMutableArray alloc] init]; }
return _ipv4LocalAddresses;
}
- (NSMutableArray<NSString *> *)ipv4SubnetMasks {
if (!_ipv4SubnetMasks) { _ipv4SubnetMasks = [[NSMutableArray alloc] init]; }
return _ipv4SubnetMasks;
}
- (NSMutableArray<NEIPv4Route *> *)ipv4IncludedRoutes {
if (!_ipv4IncludedRoutes) { _ipv4IncludedRoutes = [[NSMutableArray alloc] init]; }
return _ipv4IncludedRoutes;
}
- (NSMutableArray<NEIPv4Route *> *)ipv4ExcludedRoutes {
if (!_ipv4ExcludedRoutes) { _ipv4ExcludedRoutes = [[NSMutableArray alloc] init]; }
return _ipv4ExcludedRoutes;
}
- (NSMutableArray<NSString *> *)ipv6LocalAddresses {
if (!_ipv6LocalAddresses) { _ipv6LocalAddresses = [[NSMutableArray alloc] init]; }
return _ipv6LocalAddresses;
}
- (NSMutableArray<NSNumber *> *)ipv6NetworkPrefixLengths {
if (!_ipv6NetworkPrefixLengths) { _ipv6NetworkPrefixLengths = [[NSMutableArray alloc] init]; }
return _ipv6NetworkPrefixLengths;
}
- (NSMutableArray<NEIPv6Route *> *)ipv6IncludedRoutes {
if (!_ipv6IncludedRoutes) { _ipv6IncludedRoutes = [[NSMutableArray alloc] init]; }
return _ipv6IncludedRoutes;
}
- (NSMutableArray<NEIPv6Route *> *)ipv6ExcludedRoutes {
if (!_ipv6ExcludedRoutes) { _ipv6ExcludedRoutes = [[NSMutableArray alloc] init]; }
return _ipv6ExcludedRoutes;
}
- (NSMutableArray<NSString *> *)dnsServers {
if (!_dnsServers) { _dnsServers = [[NSMutableArray alloc] init]; }
return _dnsServers;
}
- (NSMutableArray<NSString *> *)searchDomains {
if (!_searchDomains) { _searchDomains = [[NSMutableArray alloc] init]; }
return _searchDomains;
}
- (NSMutableArray<NSString *> *)proxyExceptionList {
if (!_proxyExceptionList) { _proxyExceptionList = [[NSMutableArray alloc] init]; }
return _proxyExceptionList;
}
@end

View File

@@ -0,0 +1,35 @@
//
// OpenVPNPacket.h
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 15.01.2018.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface OpenVPNPacket : NSObject
/**
Data that can be written to the VPN socket.
*/
@property (readonly, nonatomic) NSData *vpnData;
/**
Data that can be written to the packet flow.
*/
@property (readonly, nonatomic) NSData *packetFlowData;
/**
Protocol number (e.g. PF_INET or PF_INET6) of the packet.
*/
@property (readonly, nonatomic) NSNumber *protocolFamily;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithVPNData:(NSData *)data NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithPacketFlowData:(NSData *)data protocolFamily:(NSNumber *)protocolFamily NS_DESIGNATED_INITIALIZER;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,95 @@
//
// OpenVPNPacket.m
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 15.01.2018.
//
#import "OpenVPNPacket.h"
#include <arpa/inet.h>
#include <openvpn/ip/ip.hpp>
@interface OpenVPNPacket () {
NSData *_data;
NSNumber *_protocolFamily;
}
@end
@implementation OpenVPNPacket
- (instancetype)initWithVPNData:(NSData *)data {
if (self = [super init]) {
#if TARGET_OS_IPHONE
// Get network protocol family from data prefix
NSUInteger prefix_size = sizeof(uint32_t);
uint32_t protocol = PF_UNSPEC;
[data getBytes:&protocol length:prefix_size];
protocol = CFSwapInt32BigToHost(protocol);
NSRange range = NSMakeRange(prefix_size, data.length - prefix_size);
NSData *packetData = [data subdataWithRange:range];
#else
// Get network protocol family from packet header
uint8_t header = 0;
[data getBytes:&header length:1];
uint32_t protocol = PF_UNSPEC;
uint32_t version = openvpn::IPHeader::version(header);
switch (version) {
case 4:
protocol = PF_INET;
break;
case 6:
protocol = PF_INET6;
break;
}
NSData *packetData = data;
#endif
_data = packetData;
_protocolFamily = @(protocol);
}
return self;
}
- (instancetype)initWithPacketFlowData:(NSData *)data protocolFamily:(NSNumber *)protocolFamily {
if (self = [super init]) {
_data = data;
_protocolFamily = protocolFamily;
}
return self;
}
- (NSData *)vpnData {
#if TARGET_OS_IPHONE
// Prepend data with network protocol. It should be done because OpenVPN on iOS uses uint32_t prefixes containing network
// protocol.
uint32_t prefix = CFSwapInt32HostToBig(_protocolFamily.unsignedIntegerValue);
NSUInteger prefix_size = sizeof(uint32_t);
NSMutableData *data = [NSMutableData dataWithCapacity:prefix_size + _data.length];
[data appendBytes:&prefix length:prefix_size];
[data appendData:_data];
return data;
#else
return _data;
#endif
}
- (NSData *)packetFlowData {
return _data;
}
- (NSNumber *)protocolFamily {
return _protocolFamily;
}
@end

View File

@@ -0,0 +1,28 @@
//
// OpenVPNPacketFlowBridge.h
// OpenVPN Adapter
//
// Created by Jonathan Downing on 12/10/2017.
// Modified by Sergey Abramchuk on 15/01/2018.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol OpenVPNAdapterPacketFlow;
@interface OpenVPNPacketFlowBridge: NSObject
@property (nonatomic, readonly) CFSocketRef openVPNSocket;
@property (nonatomic, readonly) CFSocketRef packetFlowSocket;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithPacketFlow:(id<OpenVPNAdapterPacketFlow>)packetFlow NS_DESIGNATED_INITIALIZER;
- (BOOL)configureSocketsWithError:(NSError **)error;
- (void)startReading;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,180 @@
//
// OpenVPNPacketFlowBridge.mm
// OpenVPN Adapter
//
// Created by Jonathan Downing on 12/10/2017.
// Modified by Sergey Abramchuk on 15/01/2018.
//
#import "OpenVPNPacketFlowBridge.h"
#include <sys/socket.h>
#include <arpa/inet.h>
#import "OpenVPNError.h"
#import "OpenVPNPacket.h"
#import "OpenVPNAdapterPacketFlow.h"
@interface OpenVPNPacketFlowBridge ()
@property (nonatomic) id<OpenVPNAdapterPacketFlow> packetFlow;
@end
@implementation OpenVPNPacketFlowBridge
- (instancetype)initWithPacketFlow:(id<OpenVPNAdapterPacketFlow>)packetFlow {
if (self = [super init]) {
_packetFlow = packetFlow;
}
return self;
}
#pragma mark - Sockets Configuration
static void SocketCallback(CFSocketRef socket, CFSocketCallBackType type, CFDataRef address, const void *data, void *obj) {
if (type != kCFSocketDataCallBack) { return; }
OpenVPNPacket *packet = [[OpenVPNPacket alloc] initWithVPNData:(__bridge NSData *)data];
OpenVPNPacketFlowBridge *bridge = (__bridge OpenVPNPacketFlowBridge *)obj;
[bridge writePackets:@[packet] toPacketFlow:bridge.packetFlow];
}
- (BOOL)configureSocketsWithError:(NSError **)error {
int sockets[2];
if (socketpair(PF_LOCAL, SOCK_DGRAM, IPPROTO_IP, sockets) == -1) {
if (error) {
NSDictionary *userInfo = @{
NSLocalizedDescriptionKey: @"Failed to create a pair of connected sockets",
NSLocalizedFailureReasonErrorKey: [NSString stringWithUTF8String:strerror(errno)],
OpenVPNAdapterErrorFatalKey: @(YES)
};
*error = [NSError errorWithDomain:OpenVPNAdapterErrorDomain
code:OpenVPNAdapterErrorSocketSetupFailed
userInfo:userInfo];
}
return NO;
}
CFSocketContext socketCtxt = {0, (__bridge void *)self, NULL, NULL, NULL};
_packetFlowSocket = CFSocketCreateWithNative(kCFAllocatorDefault, sockets[0], kCFSocketDataCallBack,
SocketCallback, &socketCtxt);
_openVPNSocket = CFSocketCreateWithNative(kCFAllocatorDefault, sockets[1], kCFSocketNoCallBack, NULL, NULL);
if (!(_packetFlowSocket && _openVPNSocket)) {
if (error) {
NSDictionary *userInfo = @{
NSLocalizedDescriptionKey: @"Failed to create core foundation sockets from native sockets",
OpenVPNAdapterErrorFatalKey: @(YES)
};
*error = [NSError errorWithDomain:OpenVPNAdapterErrorDomain
code:OpenVPNAdapterErrorSocketSetupFailed
userInfo:userInfo];
}
return NO;
}
if (!([self configureOptionsForSocket:_packetFlowSocket error:error] &&
[self configureOptionsForSocket:_openVPNSocket error:error])) { return NO; }
CFRunLoopSourceRef packetFlowSocketSource = CFSocketCreateRunLoopSource(kCFAllocatorDefault, _packetFlowSocket, 0);
CFRunLoopAddSource(CFRunLoopGetMain(), packetFlowSocketSource, kCFRunLoopDefaultMode);
CFRelease(packetFlowSocketSource);
return YES;
}
- (BOOL)configureOptionsForSocket:(CFSocketRef)socket error:(NSError **)error {
CFSocketNativeHandle socketHandle = CFSocketGetNative(socket);
int buf_value = 65536;
socklen_t buf_len = sizeof(buf_value);
if (setsockopt(socketHandle, SOL_SOCKET, SO_RCVBUF, &buf_value, buf_len) == -1) {
if (error) {
NSDictionary *userInfo = @{
NSLocalizedDescriptionKey: @"Failed to setup buffer size for input",
NSLocalizedFailureReasonErrorKey: [NSString stringWithUTF8String:strerror(errno)],
OpenVPNAdapterErrorFatalKey: @(YES)
};
*error = [NSError errorWithDomain:OpenVPNAdapterErrorDomain
code:OpenVPNAdapterErrorSocketSetupFailed
userInfo:userInfo];
}
return NO;
}
if (setsockopt(socketHandle, SOL_SOCKET, SO_SNDBUF, &buf_value, buf_len) == -1) {
if (error) {
NSDictionary *userInfo = @{
NSLocalizedDescriptionKey: @"Failed to setup buffer size for output",
NSLocalizedFailureReasonErrorKey: [NSString stringWithUTF8String:strerror(errno)],
OpenVPNAdapterErrorFatalKey: @(YES)
};
*error = [NSError errorWithDomain:OpenVPNAdapterErrorDomain
code:OpenVPNAdapterErrorSocketSetupFailed
userInfo:userInfo];
}
return NO;
}
return YES;
}
- (void)startReading {
__weak typeof(self) weakSelf = self;
[self.packetFlow readPacketsWithCompletionHandler:^(NSArray<NSData *> *packets, NSArray<NSNumber *> *protocols) {
__strong typeof(self) self = weakSelf;
[self writePackets:packets protocols:protocols toSocket:self.packetFlowSocket];
[self startReading];
}];
}
#pragma mark - TUN -> VPN
- (void)writePackets:(NSArray<NSData *> *)packets protocols:(NSArray<NSNumber *> *)protocols toSocket:(CFSocketRef)socket {
[packets enumerateObjectsUsingBlock:^(NSData *data, NSUInteger idx, BOOL *stop) {
NSNumber *protocolFamily = protocols[idx];
OpenVPNPacket *packet = [[OpenVPNPacket alloc] initWithPacketFlowData:data protocolFamily:protocolFamily];
CFSocketSendData(socket, NULL, (CFDataRef)packet.vpnData, 0.05);
}];
}
#pragma mark - VPN -> TUN
- (void)writePackets:(NSArray<OpenVPNPacket *> *)packets toPacketFlow:(id<OpenVPNAdapterPacketFlow>)packetFlow {
NSMutableArray<NSData *> *flowPackets = [[NSMutableArray alloc] init];
NSMutableArray<NSNumber *> *protocols = [[NSMutableArray alloc] init];
[packets enumerateObjectsUsingBlock:^(OpenVPNPacket * _Nonnull packet, NSUInteger idx, BOOL * _Nonnull stop) {
[flowPackets addObject:packet.packetFlowData];
[protocols addObject:packet.protocolFamily];
}];
[packetFlow writePackets:flowPackets withProtocols:protocols];
}
#pragma mark -
- (void)dealloc {
CFSocketInvalidate(_openVPNSocket);
CFRelease(_openVPNSocket);
CFSocketInvalidate(_packetFlowSocket);
CFRelease(_packetFlowSocket);
}
@end

View File

@@ -8,24 +8,24 @@
#import <Foundation/Foundation.h>
#import "OpenVPNKeyType.h"
typedef NS_ENUM(NSInteger, OpenVPNKeyType);
@interface OpenVPNPrivateKey : NSObject
+ (nullable OpenVPNPrivateKey *)keyWithPEM:(nonnull NSData *)pemData
password:(nullable NSString *)password
error:(out NSError * __nullable * __nullable)error;
error:(out NSError * _Nullable * _Nullable)error;
+ (nullable OpenVPNPrivateKey *)keyWithDER:(nonnull NSData *)derData
password:(nullable NSString *)password
error:(out NSError * __nullable * __nullable)error;
error:(out NSError * _Nullable * _Nullable)error;
- (nonnull instancetype) __unavailable init;
- (nonnull instancetype) init NS_UNAVAILABLE;
@property (nonatomic, readonly) NSInteger size;
@property (nonatomic, readonly) OpenVPNKeyType type;
- (nullable NSData *)pemData:(out NSError * __nullable * __nullable)error;
- (nullable NSData *)derData:(out NSError * __nullable * __nullable)error;
- (nullable NSData *)pemData:(out NSError * _Nullable * _Nullable)error;
- (nullable NSData *)derData:(out NSError * _Nullable * _Nullable)error;
@end

View File

@@ -6,12 +6,13 @@
//
//
#import <mbedtls/pk.h>
#import "NSError+Message.h"
#import "OpenVPNError.h"
#import "OpenVPNPrivateKey.h"
#include <mbedtls/pk.h>
#import "OpenVPNKeyType.h"
#import "NSError+OpenVPNError.h"
@interface OpenVPNPrivateKey ()
@property (nonatomic, assign) mbedtls_pk_context *ctx;
@@ -20,23 +21,6 @@
@implementation OpenVPNPrivateKey
- (instancetype)init {
self = [super init];
if (self) {
self.ctx = malloc(sizeof(mbedtls_pk_context));
mbedtls_pk_init(self.ctx);
}
return self;
}
- (NSInteger)size {
return mbedtls_pk_get_bitlen(self.ctx);
}
- (OpenVPNKeyType)type {
return (OpenVPNKeyType)mbedtls_pk_get_type(self.ctx);
}
+ (nullable OpenVPNPrivateKey *)keyWithPEM:(NSData *)pemData password:(NSString *)password error:(out NSError **)error {
OpenVPNPrivateKey *key = [OpenVPNPrivateKey new];
@@ -45,14 +29,12 @@
size_t pem_length = strlen(pemString.UTF8String) + 1;
size_t password_length = password != nil ? strlen(password.UTF8String) : 0;
int result = mbedtls_pk_parse_key(key.ctx, (const unsigned char *)pemString.UTF8String, pem_length, (const unsigned char *)password.UTF8String, password_length);
int result = mbedtls_pk_parse_key(key.ctx, (const unsigned char *)pemString.UTF8String,
pem_length, (const unsigned char *)password.UTF8String, password_length);
if (result < 0) {
if (error) {
NSString *reason = [NSError reasonFromResult:result];
*error = [NSError errorWithDomain:OpenVPNIdentityErrorDomain code:result userInfo:@{
NSLocalizedDescriptionKey: @"Failed to read PEM data.",
NSLocalizedFailureReasonErrorKey: reason
}];
*error = [NSError ovpn_errorObjectForMbedTLSError:result description:@"Failed to read PEM data"];
}
return nil;
@@ -66,14 +48,12 @@
size_t password_length = password != nil ? strlen(password.UTF8String) : 0;
int result = mbedtls_pk_parse_key(key.ctx, derData.bytes, derData.length, (const unsigned char *)password.UTF8String, password_length);
int result = mbedtls_pk_parse_key(key.ctx, derData.bytes,
derData.length, (const unsigned char *)password.UTF8String, password_length);
if (result < 0) {
if (error) {
NSString *reason = [NSError reasonFromResult:result];
*error = [NSError errorWithDomain:OpenVPNIdentityErrorDomain code:result userInfo:@{
NSLocalizedDescriptionKey: @"Failed to read DER data.",
NSLocalizedFailureReasonErrorKey: reason
}];
*error = [NSError ovpn_errorObjectForMbedTLSError:result description:@"Failed to read DER data"];
}
return nil;
@@ -82,6 +62,22 @@
return key;
}
- (instancetype)init {
if (self = [super init]) {
_ctx = malloc(sizeof(mbedtls_pk_context));
mbedtls_pk_init(_ctx);
}
return self;
}
- (NSInteger)size {
return mbedtls_pk_get_bitlen(self.ctx);
}
- (OpenVPNKeyType)type {
return (OpenVPNKeyType)mbedtls_pk_get_type(self.ctx);
}
- (NSData *)pemData:(out NSError **)error {
size_t buffer_length = mbedtls_pk_get_len(self.ctx) * 10;
unsigned char *pem_buffer = malloc(buffer_length);
@@ -89,18 +85,15 @@
int result = mbedtls_pk_write_key_pem(self.ctx, pem_buffer, buffer_length);
if (result < 0) {
if (error) {
NSString *reason = [NSError reasonFromResult:result];
*error = [NSError errorWithDomain:OpenVPNIdentityErrorDomain code:result userInfo:@{
NSLocalizedDescriptionKey: @"Failed to write PEM data.",
NSLocalizedFailureReasonErrorKey: reason
}];
*error = [NSError ovpn_errorObjectForMbedTLSError:result description:@"Failed to write PEM data"];
}
free(pem_buffer);
return nil;
}
NSData *pemData = [[NSString stringWithCString:(const char *)pem_buffer encoding:NSUTF8StringEncoding] dataUsingEncoding:NSUTF8StringEncoding];
NSData *pemData = [[NSString stringWithCString:(const char *)pem_buffer
encoding:NSUTF8StringEncoding] dataUsingEncoding:NSUTF8StringEncoding];
free(pem_buffer);
return pemData;
@@ -113,11 +106,7 @@
int result = mbedtls_pk_write_key_der(self.ctx, der_buffer, buffer_length);
if (result < 0) {
if (error) {
NSString *reason = [NSError reasonFromResult:result];
*error = [NSError errorWithDomain:OpenVPNIdentityErrorDomain code:result userInfo:@{
NSLocalizedDescriptionKey: @"Failed to write DER data.",
NSLocalizedFailureReasonErrorKey: reason
}];
*error = [NSError ovpn_errorObjectForMbedTLSError:result description:@"Failed to write DER data"];
}
free(der_buffer);
@@ -134,8 +123,8 @@
}
- (void)dealloc {
mbedtls_pk_free(self.ctx);
free(self.ctx);
mbedtls_pk_free(_ctx);
free(_ctx);
}
@end

View File

@@ -6,10 +6,10 @@
//
//
#import <client/ovpncli.hpp>
#import "OpenVPNProperties.h"
#include <client/ovpncli.hpp>
using namespace openvpn;
@interface OpenVPNProperties (Internal)

View File

@@ -8,8 +8,7 @@
#import <Foundation/Foundation.h>
#import "OpenVPNTransportProtocol.h"
typedef NS_ENUM(NSInteger, OpenVPNTransportProtocol);
@class OpenVPNServerEntry;
@interface OpenVPNProperties : NSObject
@@ -47,7 +46,7 @@
/**
YES if this profile requires a private key password
*/
@property (readonly, nonatomic) BOOL privateKeyPasswordRequired;
@property (readonly, nonatomic, getter=isPrivateKeyPasswordRequired) BOOL privateKeyPasswordRequired;
/**
YES if user is allowed to save authentication password in UI
@@ -74,6 +73,6 @@
*/
@property (nullable, readonly, nonatomic) NSArray<OpenVPNServerEntry *> *servers;
- (nonnull instancetype) __unavailable init;
- (nonnull instancetype) init NS_UNAVAILABLE;
@end

View File

@@ -6,20 +6,20 @@
//
//
#import <openvpn/common/number.hpp>
#import "OpenVPNProperties.h"
#import "OpenVPNProperties+Internal.h"
#include <openvpn/common/number.hpp>
#import "OpenVPNConfiguration+Internal.h"
#import "OpenVPNServerEntry+Internal.h"
#import "OpenVPNProperties.h"
#import "OpenVPNProperties+Internal.h"
using namespace openvpn;
@implementation OpenVPNProperties
- (instancetype)initWithEvalConfig:(ClientAPI::EvalConfig)eval {
self = [super init];
if (self) {
if (self = [super init]) {
_username = !eval.userlockedUsername.empty() ? [NSString stringWithUTF8String:eval.userlockedUsername.c_str()] : nil;
_profileName = !eval.profileName.empty() ? [NSString stringWithUTF8String:eval.profileName.c_str()] : nil;
@@ -44,6 +44,7 @@ using namespace openvpn;
_remoteProto = [OpenVPNConfiguration getTransportProtocolFromValue:currentProto];
_servers = nil;
if (!eval.serverList.empty()) {
NSMutableArray *servers = [NSMutableArray new];

View File

@@ -6,7 +6,6 @@
//
//
#import "OpenVPNReachabilityTracker.h"
#import "OpenVPNReachability.h"
@interface OpenVPNReachability (Internal)

View File

@@ -7,11 +7,12 @@
//
#import <Foundation/Foundation.h>
#import "OpenVPNReachabilityStatus.h"
typedef NS_ENUM(NSInteger, OpenVPNReachabilityStatus);
@interface OpenVPNReachability : NSObject
@property (readonly, nonatomic) BOOL isTracking;
@property (readonly, nonatomic, getter=isTracking) BOOL tracking;
@property (readonly, nonatomic) OpenVPNReachabilityStatus reachabilityStatus;
- (nonnull instancetype)init;

View File

@@ -6,11 +6,14 @@
//
//
#import <openvpn/apple/reachable.hpp>
#import "OpenVPNReachability.h"
#import "OpenVPNReachability+Internal.h"
#include <openvpn/apple/reachable.hpp>
#import "OpenVPNReachabilityTracker.h"
#import "OpenVPNReachabilityStatus.h"
@interface OpenVPNReachability () {
BOOL _isTracking;
}
@@ -45,13 +48,12 @@
}
}
- (nonnull instancetype)init {
self = [super init];
if (self) {
- (instancetype)init {
if (self = [super init]) {
_isTracking = NO;
self.tracker = new OpenVPNReachabilityTracker(true, false, (__bridge void *)self);
self.reachability = new Reachability(true, true);
_tracker = new OpenVPNReachabilityTracker(true, false, (__bridge void *)self);
_reachability = new Reachability(true, true);
}
return self;
}
@@ -77,8 +79,8 @@
}
- (void)dealloc {
delete self.tracker;
delete self.reachability;
delete _tracker;
delete _reachability;
}
@end

View File

@@ -6,7 +6,7 @@
//
//
#import <openvpn/apple/reachable.hpp>
#include <openvpn/apple/reachable.hpp>
using namespace openvpn;

View File

@@ -6,10 +6,14 @@
//
//
#import "OpenVPNReachability+Internal.h"
#import "OpenVPNReachabilityTracker.h"
OpenVPNReachabilityTracker::OpenVPNReachabilityTracker(const bool enable_internet, const bool enable_wifi, void* handler) : ReachabilityTracker(enable_internet, enable_wifi) {
#import "OpenVPNReachability+Internal.h"
#import "OpenVPNReachabilityStatus.h"
OpenVPNReachabilityTracker::OpenVPNReachabilityTracker(const bool enable_internet, const bool enable_wifi, void* handler) :
ReachabilityTracker(enable_internet, enable_wifi)
{
this->handler = handler;
}

View File

@@ -6,10 +6,10 @@
//
//
#import <client/ovpncli.hpp>
#import "OpenVPNServerEntry.h"
#include <client/ovpncli.hpp>
using namespace openvpn;
@interface OpenVPNServerEntry (Internal)

View File

@@ -13,6 +13,6 @@
@property (nullable, readonly, nonatomic) NSString *server;
@property (nullable, readonly, nonatomic) NSString *friendlyName;
- (nonnull instancetype) __unavailable init;
- (nonnull instancetype) init NS_UNAVAILABLE;
@end

View File

@@ -12,8 +12,7 @@
@implementation OpenVPNServerEntry
- (instancetype)initWithServerEntry:(ClientAPI::ServerEntry)entry {
self = [super init];
if (self) {
if (self = [super init]) {
_server = !entry.server.empty() ? [NSString stringWithUTF8String:entry.server.c_str()] : nil;
_friendlyName = !entry.friendlyName.empty() ? [NSString stringWithUTF8String:entry.friendlyName.c_str()] : nil;
}

View File

@@ -6,10 +6,10 @@
//
//
#import <client/ovpncli.hpp>
#import "OpenVPNSessionToken.h"
#include <client/ovpncli.hpp>
using namespace openvpn;
@interface OpenVPNSessionToken (Internal)

View File

@@ -6,6 +6,7 @@
//
//
#import "OpenVPNSessionToken.h"
#import "OpenVPNSessionToken+Internal.h"
using namespace openvpn;
@@ -18,7 +19,7 @@ using namespace openvpn;
@implementation OpenVPNSessionToken
- (instancetype)initWithSessionToken:(ClientAPI::SessionToken)token {
if ((self = [super init])) {
if (self = [super init]) {
self.username = !token.username.empty() ? [NSString stringWithUTF8String:token.username.c_str()] : nil;
self.session = !token.session_id.empty() ? [NSString stringWithUTF8String:token.session_id.c_str()] : nil;
}
@@ -38,7 +39,7 @@ using namespace openvpn;
}
- (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder {
if ((self = [self init])) {
if (self = [self init]) {
self.username = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(username))];
self.session = [aDecoder decodeObjectOfClass:[NSString class] forKey:NSStringFromSelector(@selector(session))];
}

View File

@@ -6,10 +6,10 @@
//
//
#import <client/ovpncli.hpp>
#import "OpenVPNTransportStats.h"
#include <client/ovpncli.hpp>
using namespace openvpn;
@interface OpenVPNTransportStats (Internal)

View File

@@ -6,6 +6,7 @@
//
//
#import "OpenVPNTransportStats.h"
#import "OpenVPNTransportStats+Internal.h"
using namespace openvpn;
@@ -21,12 +22,13 @@ using namespace openvpn;
@implementation OpenVPNTransportStats
- (instancetype)initWithTransportStats:(ClientAPI::TransportStats)stats {
if ((self = [self init])) {
if (self = [self init]) {
self.bytesIn = stats.bytesIn;
self.bytesOut = stats.bytesOut;
self.packetsIn = stats.packetsIn;
self.packetsOut = stats.packetsOut;
self.lastPacketReceived = stats.lastPacketReceived >= 0 ? [NSDate dateWithTimeIntervalSinceNow:stats.lastPacketReceived / -1024.0] : nil;
self.lastPacketReceived = stats.lastPacketReceived >= 0 ?
[NSDate dateWithTimeIntervalSinceNow:stats.lastPacketReceived / -1024.0] : nil;
}
return self;
}
@@ -50,12 +52,13 @@ using namespace openvpn;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
if ((self = [super init])) {
if (self = [super init]) {
self.bytesIn = [aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(bytesIn))];
self.bytesOut = [aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(bytesOut))];
self.packetsIn = [aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(packetsIn))];
self.packetsOut = [aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(packetsOut))];
self.lastPacketReceived = [aDecoder decodeObjectOfClass:[NSDate class] forKey:NSStringFromSelector(@selector(lastPacketReceived))];
self.lastPacketReceived = [aDecoder decodeObjectOfClass:[NSDate class]
forKey:NSStringFromSelector(@selector(lastPacketReceived))];
}
return self;
}

View File

@@ -1,23 +0,0 @@
//
// OpenVPNTunnelSettings.h
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 26.02.17.
//
//
#import <Foundation/Foundation.h>
@interface OpenVPNTunnelSettings : NSObject
@property (nonatomic) BOOL initialized;
@property (readonly, strong, nonatomic) NSMutableArray *localAddresses;
@property (readonly, strong, nonatomic) NSMutableArray *prefixLengths;
@property (readonly, strong, nonatomic) NSMutableArray *includedRoutes;
@property (readonly, strong, nonatomic) NSMutableArray *excludedRoutes;
@property (readonly, strong, nonatomic) NSMutableArray *dnsAddresses;
@end

View File

@@ -1,30 +0,0 @@
//
// OpenVPNTunnelSettings.m
// OpenVPN Adapter
//
// Created by Sergey Abramchuk on 26.02.17.
//
//
#import "OpenVPNTunnelSettings.h"
@implementation OpenVPNTunnelSettings
- (instancetype)init
{
self = [super init];
if (self) {
_initialized = NO;
_localAddresses = [NSMutableArray new];
_prefixLengths = [NSMutableArray new];
_includedRoutes = [NSMutableArray new];
_excludedRoutes = [NSMutableArray new];
_dnsAddresses = [NSMutableArray new];
}
return self;
}
@end

View File

@@ -32,7 +32,7 @@ FOUNDATION_EXPORT const unsigned char OpenVPNAdapterVersionString[];
#import <OpenVPNAdapter/OpenVPNTransportStats.h>
#import <OpenVPNAdapter/OpenVPNInterfaceStats.h>
#import <OpenVPNAdapter/OpenVPNAdapter.h>
#import <OpenVPNAdapter/OpenVPNAdapter+Public.h>
#import <OpenVPNAdapter/OpenVPNAdapterPacketFlow.h>
#import <OpenVPNAdapter/OpenVPNKeyType.h>
#import <OpenVPNAdapter/OpenVPNCertificate.h>
#import <OpenVPNAdapter/OpenVPNPrivateKey.h>

View File

@@ -1 +1,4 @@
README.html
x64
*.vcxproj.user
*.ipch

View File

@@ -0,0 +1,60 @@
dist: trusty
os: linux
language: cpp
env:
global:
- secure: "dqiLqbzug/xs6F4Q9ei1pGpNf9Q6H3+iKN1W+P0TtODbCXPr/mLWdvHGVMIMqr7H7rBrIUPFPrfqd80nu3jQuQonjcHK/XyJJfmf5hUdhGAszSaixhWnGfVmn/VSV7/5+9DGAU3l9S6YZg4lvi12+cOrlblNgx8GeI5VdN/6HBSHkEqKNI56qn3Y+ugSdLeL1opmzlY58vRsCCmpBH8Ronn4tmSyi85/WZXfF43o9FGGJcygdh6QVWA1CDdNMeLTCt9ld+oToUIiFLiUrhfS1JpSvzysz2xsuEntxZaTMDYPyL4+O8Mj/scl6ejLLXzxTNa7AZOgySLBahf+F4b+yhL1deSVuu40MfxPW6XiM1jKy3KPH/GlYgM8CZQ3D1hQIq1CIUg8DgnTa06RUzevsR5DqDvz+EcPanFHE7dHGrPy9Rs/0y59dNHp3qWKjWMoSA06GerbF61XFOb4mcE29053kV8uxqIa5ZShZ/ndoLeVpQ4mZ+/XSkUybysVl0gWrKnnNNEPtqrdmKf+jlmKY0jyRPdwf425Ldn+wcbGw9ZEnkosYzqAhDBDX4OETAKLi8G0FEYECKKQcd1OX+HNvsOIyOAoLOj7H30F8UkPsjR3ysdIEmc6702ly06gDYjWmwQaCigL/1ktRKgf7ePB0HS+8fOa5SML7619kQrGrWA="
- PREFIX="${HOME}/opt"
- ASIO_VERSION="862aed305dcf91387535519c9549c17630339a12"
- LZ4_VERSION="1.7.5"
- MBEDTLS_VERSION="2.5.1"
- MBEDTLS_CFLAGS="-I${PREFIX}/include"
- MBEDTLS_LIBS="-lmbedtls -lmbedx509 -lmbedcrypto"
- OPENSSL_VERSION="1.0.2l"
- OPENSSL_CFLAGS="-I${PREFIX}/include"
- OPENSSL_LIBS="-lssl -lcrypto"
- COVERITY_BRANCH="master"
matrix:
include:
- env: SSLLIB="openssl"
os: osx
osx_image: xcode8.3
compiler: clang
- env: SSLLIB="mbedtls"
os: osx
osx_image: xcode8.3
compiler: clang
- env: SSLLIB="openssl" RUN_COVERITY_SCAN="1"
os: linux
compiler: gcc
- env: SSLLIB="openssl"
os: linux
compiler: clang
- env: SSLLIB="mbedtls"
os: linux
compiler: gcc
- env: SSLLIB="mbedtls"
os: linux
compiler: clang
addons:
apt:
packages:
- libboost-all-dev
- linux-libc-dev
cache:
ccache: true
directories:
- download-cache
- ${HOME}/opt
install:
- .travis/build-deps.sh
script:
- .travis/build-check.sh

View File

@@ -0,0 +1,75 @@
#!/bin/sh
set -eux
PREFIX="${PREFIX:-${HOME}/opt}"
RUN_COVERITY_SCAN="${RUN_COVERITY_SCAN:-0}"
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
export LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH:-}"
fi
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
export DYLD_LIBRARY_PATH="${PREFIX}/lib:${DYLD_LIBRARY_PATH:-}"
fi
if [ "${SSLLIB}" = "openssl" ]; then
SSL_LIBS="${OPENSSL_LIBS}"
SSL_CFLAGS="-DUSE_OPENSSL"
elif [ "${SSLLIB}" = "mbedtls" ]; then
SSL_LIBS="${MBEDTLS_LIBS}"
SSL_CFLAGS="-DUSE_MBEDTLS"
else
echo "Invalid crypto lib: ${SSLLIB}"
exit 1
fi
LIBS="${SSL_LIBS} -llz4"
CXXFLAGS="-O3 -std=c++11 -Wall -pthread \
-DOPENVPN_SHOW_SESSION_TOKEN -DHAVE_LZ4 \
-DUSE_ASIO -DASIO_STANDALONE -DASIO_NO_DEPRECATED ${SSL_CFLAGS}"
if [[ "${CC}" == "gcc"* ]]; then
CXXFLAGS="${CXXFLAGS} -fwhole-program -flto=4"
fi
INCLUDEDIRS="-I../../asio/asio/include -I${PREFIX}/include -I../../"
LDFLAGS="-L${PREFIX}/lib"
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
LDFLAGS="${LDFLAGS} -Wl,--no-as-needed"
fi
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
CXXFLAGS="${CXXFLAGS} -stdlib=libc++ -arch x86_64"
LIBS="${LIBS} -framework Security \
-framework CoreFoundation \
-framework SystemConfiguration \
-framework IOKit \
-framework ApplicationServices"
fi
(
cd test/ovpncli
${CXX} ${CXXFLAGS} ${INCLUDEDIRS} ${LDFLAGS} cli.cpp -o cli ${LIBS}
)
(
cd test/ssl
${CXX} ${CXXFLAGS} -DNOERR ${INCLUDEDIRS} ${LDFLAGS} proto.cpp -o proto ${LIBS}
./proto
)
if [ "${RUN_COVERITY_SCAN}" = "1" -a "${TRAVIS_BRANCH}" = "${COVERITY_BRANCH}" ]; then
unset LD_LIBRARY_PATH #don't mess up SSL for curl/wget
export COVERITY_SCAN_PROJECT_NAME="OpenVPN/openvpn3"
export COVERITY_SCAN_BRANCH_PATTERN="${COVERITY_BRANCH}"
export COVERITY_SCAN_NOTIFICATION_EMAIL="scan-reports@openvpn.net"
export COVERITY_SCAN_BUILD_COMMAND_PREPEND="cd test/ssl"
export COVERITY_SCAN_BUILD_COMMAND="${CXX} ${CXXFLAGS} ${INCLUDEDIRS} \
${LDFLAGS} proto.cpp -o proto ${LIBS}"
# Ignore exit code, script exits with 1 if we're not on the right branch
curl -s "https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh" | bash || true
fi

View File

@@ -0,0 +1,133 @@
#!/bin/sh
set -eux
# Set defaults
PREFIX="${PREFIX:-${HOME}/opt}"
download_asio () {
if [ ! -d "download-cache/asio" ]; then
git clone https://github.com/chriskohlhoff/asio.git \
download-cache/asio
else
(
cd download-cache/asio
if [ "$(git log -1 --format=%H)" != "${ASIO_VERSION}" ]; then
git checkout master
git pull
git checkout ${ASIO_VERSION}
fi
)
fi
}
build_asio () {
(
if [ ! -L asio ]; then
rm -Rf asio
ln -s download-cache/asio asio
fi
)
}
download_lz4 () {
if [ ! -f "download-cache/lz4-${LZ4_VERSION}.tar.gz" ]; then
wget "https://github.com/lz4/lz4/archive/v${LZ4_VERSION}.tar.gz" \
-O download-cache/lz4-${LZ4_VERSION}.tar.gz
fi
}
build_lz4 () {
if [ "$(cat ${PREFIX}/.lz4-version)" != "${LZ4_VERSION}" ]; then
tar zxf download-cache/lz4-${LZ4_VERSION}.tar.gz
(
cd "lz4-${LZ4_VERSION}"
make default CC=$CC CXX=$CXX
make install PREFIX="${PREFIX}"
)
echo "${LZ4_VERSION}" > "${PREFIX}/.lz4-version"
fi
}
download_mbedtls () {
if [ ! -f "download-cache/mbedtls-${MBEDTLS_VERSION}-apache.tgz" ]; then
wget -P download-cache/ \
"https://tls.mbed.org/download/mbedtls-${MBEDTLS_VERSION}-apache.tgz"
fi
}
build_mbedtls () {
if [ "$(cat ${PREFIX}/.mbedtls-version)" != "${MBEDTLS_VERSION}" ]; then
tar zxf download-cache/mbedtls-${MBEDTLS_VERSION}-apache.tgz
(
cd "mbedtls-${MBEDTLS_VERSION}"
make CC=$CC CXX=$CXX
make install DESTDIR="${PREFIX}"
)
echo "${MBEDTLS_VERSION}" > "${PREFIX}/.mbedtls-version"
fi
}
download_openssl () {
if [ ! -f "download-cache/openssl-${OPENSSL_VERSION}.tar.gz" ]; then
wget -P download-cache/ \
"https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
fi
}
build_openssl_linux () {
(
cd "openssl-${OPENSSL_VERSION}/"
./config shared --prefix="${PREFIX}" --openssldir="${PREFIX}" -DPURIFY
make all install_sw
)
}
build_openssl_osx () {
(
cd "openssl-${OPENSSL_VERSION}/"
./Configure darwin64-x86_64-cc shared \
--prefix="${PREFIX}" --openssldir="${PREFIX}" -DPURIFY
make depend all install_sw
)
}
build_openssl () {
if [ "$(cat ${PREFIX}/.openssl-version)" != "${OPENSSL_VERSION}" ]; then
tar zxf "download-cache/openssl-${OPENSSL_VERSION}.tar.gz"
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
build_openssl_osx
elif [ "${TRAVIS_OS_NAME}" = "linux" ]; then
build_openssl_linux
fi
echo "${OPENSSL_VERSION}" > "${PREFIX}/.openssl-version"
fi
}
# Enable ccache
if [ "${TRAVIS_OS_NAME}" != "osx" ] && [ -z ${CHOST+x} ]; then
# ccache not available on osx, see:
# https://github.com/travis-ci/travis-ci/issues/5567
# also ccache not enabled for cross builds
mkdir -p "${HOME}/bin"
ln -s "$(which ccache)" "${HOME}/bin/${CXX}"
ln -s "$(which ccache)" "${HOME}/bin/${CC}"
PATH="${HOME}/bin:${PATH}"
fi
# Download and build crypto lib
if [ "${SSLLIB}" = "openssl" ]; then
download_openssl
build_openssl
elif [ "${SSLLIB}" = "mbedtls" ]; then
download_mbedtls
build_mbedtls
else
echo "Invalid crypto lib: ${SSLLIB}"
exit 1
fi
download_asio
build_asio
download_lz4
build_lz4

View File

@@ -1,5 +1,5 @@
Contributor agreement for the OpenVPN project version 1.2 - March 2017
########################################################################
Contributor agreement for the OpenVPN project version 1.3 - December 2017
#########################################################################
This Contributor Agreement consists of two parts. Part I is the
Developer Certificate of Origin available at
@@ -8,7 +8,7 @@ http://developercertificate.org/.
In this contributor agreement, "This project" refers to the OpenVPN
project and
"open source license indicated in `the file <LICENSE.rst>`_" refers to
the GPLv3 license with an additional permission that allows linking
the AGPLv3 license with an additional permission that allows linking
the OpenSSL software, https://www.openssl.org/, with the OpenVPN
software.
@@ -50,16 +50,14 @@ the open source license(s) involved.
Part II
#######
Copyright (C) 2017 OpenVPN Technologies, Inc.
Copyright (C) 2017 OpenVPN Inc.
In addition:
(e) I understand that OpenVPN Technologies, Inc. may relicense this
project, this contribution, and any modification to it under any
license. I certify that I, or the person on whose behalf I am
submitting the contribution, have the right to grant and hereby grant
OpenVPN Technologies, Inc. a license to do so for this
contribution. My grant is made on the condition that OpenVPN
Technologies, Inc. will make any modification to this contribution
available to the OpenVPN project under the open source license
indicated in the file.
(e) I understand that OpenVPN Inc. may relicense this project, this
contribution, and any modification to it under any license. I certify that I,
or the person on whose behalf I am submitting the contribution, have the
right to grant and hereby grant OpenVPN Inc. a license to do so for this
contribution. My grant is made on the condition that OpenVPN Inc. will make
any modification to this contribution available to the OpenVPN project under
the open source license indicated in the file.

View File

@@ -1,5 +1,5 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
@@ -7,17 +7,15 @@
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
@@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
@@ -72,7 +60,7 @@ modification follow.
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
@@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
@@ -635,40 +633,29 @@ the "copyright" line and a pointer to where the full notice is found.
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU Affero General Public License for more details.
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -1,10 +1,10 @@
OpenVPN 3 is distributed under
`GNU General Public License version 3 <COPYRIGHT.GPLV3>`_
`GNU Affero General Public License version 3 <COPYRIGHT.AGPLV3>`_
with a special permission to link against OpenSSL:
::
Additional permission under GNU GPL version 3 section 7
Additional permission under GNU AGPL version 3 section 7
If you modify this Program, or any covered work, by linking or combining
it with OpenSSL (or a modified version of that library), containing parts

View File

@@ -145,6 +145,65 @@ To connect::
$ ./cli client.ovpn
Building the OpenVPN 3 client on Windows
----------------------------------------
Those instructions were tested with Git Bash.
Prerequisites:
- Visual Studio 2015
- Python 2.7
To make python interpreter work inside Git Bash terminal, add::
alias python='winpty python.exe'
to ``.bashrc``.
Clone the OpenVPN 3 source repo::
$ mkdir ovpn3
$ cd ovpn3
$ git clone https://github.com/OpenVPN/openvpn3.git core
Create ``parms_local.py`` inside ``~/ovpn3/core/win`` directory which overrides build settings from ``parms.py``. For example:
.. code-block:: python
PARMS = {
"OVPN3" : "c:\\Users\\user\\Projects\\ovpn3",
"TAP" : "c:\\Users\\user\\Projects\\tap-windows",
"DEP" : "c:\\Users\\user\\Downloads",
"BUILD" : "c:\\Users\\user\\Projects\\ovpn3-build",
"LIB_VERSIONS" : {
"asio" : "asio-cc1bd58f9ebb15afbebf53207015ff690b338195"
},
"GTEST_ROOT": "c:\\Users\\user\\Projects\\googletest"
}
Download dependencies as tar(zip)balls to DEP directory defined in previous step:
1. Asio — https://github.com/chriskohlhoff/asio
2. mbed TLS (2.3.0 or higher) — https://tls.mbed.org/
3. LZ4 — https://github.com/Cyan4973/lz4
Extract and build dependencies (assuming you are in ``~/ovpn3/core/win`` directory)::
$ python buildep.py
Build the OpenVPN 3 client executable:
$ python build.py
Visual Studio 2015 project and solution files are located in ``~/ovpn3/core/win`` directory.
Before opening project you need to build dependencies and define environmental variables:
- OVPN3_BUILD - path where dependencies are build (BUILD in parms.py)
- OVPN3_CORE - path where ovpn3-core was checked out (OVPN3 in parms.py)
- OVPN3_TAP_WINDOWS - path where tap-windows was checked out (TAP in parms.py)
Testing
-------
@@ -175,6 +234,36 @@ Run the test::
user 0m15.800s
sys 0m0.004s
The OpenVPN 3 core also includes unit tests, which are based on
Google Test framework. To run unit tests, you need to install
CMake and build Google Test.
Building Google Test on Linux::
$ git clone https://github.com/google/googletest.git
$ cd googletest
$ cmake . && cmake --build .
Building Google Test on Windows::
> git clone https://github.com/google/googletest.git
> cd googletest
> cmake -G "Visual Studio 14 2015 Win64" .
> cmake --build .
After Google Test is built you are ready to build and run unit tests.
Build and run tests on Linux::
$ cd ovpn3/core/test/unittests
$ GTEST_DIR=~/googletest ECHO=1 PROF=linux ASIO_DIR=~/asio MTLS_SYS=1 LZ4_SYS=1 NOSSL=1 $O3/core/scripts/build test_log
$ ./test_log
Build and run tests on Windows::
$ cd ovpn3/core/win
$ python build.py ../test/unittests/test_log.cpp unittest
$ test_log.exe
Developer Guide
---------------
@@ -553,3 +642,4 @@ License
-------
See `<LICENSE.rst>`_.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.
@@ -406,11 +406,13 @@ namespace openvpn {
// extra settings submitted by API client
std::string server_override;
std::string port_override;
Protocol proto_override;
IPv6Setting ipv6;
int conn_timeout = 0;
bool tun_persist = false;
bool google_dns_fallback = false;
bool synchronous_dns_lookup = false;
bool autologin_sessions = false;
std::string private_key_password;
std::string external_pki_alias;
@@ -475,6 +477,8 @@ namespace openvpn {
~ClientState()
{
stop_scope_local.reset();
stop_scope_global.reset();
socket_protect.detach_from_parent();
reconnect_notify.detach_from_parent();
remote_override.detach_from_parent();
@@ -532,6 +536,17 @@ namespace openvpn {
clock_tick->cancel();
}
void setup_async_stop_scopes()
{
stop_scope_local.reset(new AsioStopScope(*io_context(), async_stop_local(), [this]() {
session->graceful_stop();
}));
stop_scope_global.reset(new AsioStopScope(*io_context(), async_stop_global(), [this]() {
trigger_async_stop_local();
}));
}
private:
ClientState(const ClientState&) = delete;
ClientState& operator=(const ClientState&) = delete;
@@ -541,6 +556,9 @@ namespace openvpn {
Stop async_stop_local_;
Stop* async_stop_global_ = nullptr;
std::unique_ptr<AsioStopScope> stop_scope_local;
std::unique_ptr<AsioStopScope> stop_scope_global;
openvpn_io::io_context* io_context_ = nullptr;
bool io_context_owned = false;
@@ -630,9 +648,11 @@ namespace openvpn {
{
try {
state->server_override = config.serverOverride;
state->port_override = config.portOverride;
state->conn_timeout = config.connTimeout;
state->tun_persist = config.tunPersist;
state->google_dns_fallback = config.googleDnsFallback;
state->synchronous_dns_lookup = config.synchronousDnsLookup;
state->autologin_sessions = config.autologinSessions;
state->private_key_password = config.privateKeyPassword;
if (!config.protoOverride.empty())
@@ -828,150 +848,194 @@ namespace openvpn {
OPENVPN_CLIENT_EXPORT Status OpenVPNClient::do_connect()
{
Status ret;
bool in_run = false;
connect_attach();
Status status;
bool session_started = false;
try {
// set global MbedTLS debug level
#if defined(USE_MBEDTLS) || defined(USE_MBEDTLS_APPLE_HYBRID)
mbedtls_debug_set_threshold(state->ssl_debug_level); // fixme -- using a global method for this seems wrong
#endif
// load options
ClientOptions::Config cc;
cc.cli_stats = state->stats;
cc.cli_events = state->events;
cc.server_override = state->server_override;
cc.proto_override = state->proto_override;
cc.ipv6 = state->ipv6;
cc.conn_timeout = state->conn_timeout;
cc.tun_persist = state->tun_persist;
cc.google_dns_fallback = state->google_dns_fallback;
cc.autologin_sessions = state->autologin_sessions;
cc.proto_context_options = state->proto_context_options;
cc.http_proxy_options = state->http_proxy_options;
cc.alt_proxy = state->alt_proxy;
cc.dco = state->dco;
cc.echo = state->echo;
cc.info = state->info;
cc.reconnect_notify = &state->reconnect_notify;
if (remote_override_enabled())
cc.remote_override = &state->remote_override;
cc.private_key_password = state->private_key_password;
cc.disable_client_cert = state->disable_client_cert;
cc.ssl_debug_level = state->ssl_debug_level;
cc.default_key_direction = state->default_key_direction;
cc.force_aes_cbc_ciphersuites = state->force_aes_cbc_ciphersuites;
cc.tls_version_min_override = state->tls_version_min_override;
cc.tls_cert_profile_override = state->tls_cert_profile_override;
cc.gui_version = state->gui_version;
cc.extra_peer_info = state->extra_peer_info;
cc.stop = state->async_stop_local();
#ifdef OPENVPN_GREMLIN
cc.gremlin_config = state->gremlin_config;
#endif
#if defined(USE_TUN_BUILDER)
cc.socket_protect = &state->socket_protect;
cc.builder = this;
#endif
#if defined(OPENVPN_EXTERNAL_TUN_FACTORY)
cc.extern_tun_factory = this;
#endif
// force Session ID use and disable password cache if static challenge is enabled
if (state->creds
&& !state->creds->get_replace_password_with_session_id()
&& !state->eval.autologin
&& !state->eval.staticChallenge.empty())
{
state->creds->set_replace_password_with_session_id(true);
state->creds->enable_password_cache(false);
}
// external PKI
#if !defined(USE_APPLE_SSL)
if (state->eval.externalPki && !state->disable_client_cert)
{
if (!state->external_pki_alias.empty())
{
ExternalPKICertRequest req;
req.alias = state->external_pki_alias;
external_pki_cert_request(req);
if (!req.error)
{
cc.external_pki = this;
process_epki_cert_chain(req);
}
else
{
external_pki_error(req, Error::EPKI_CERT_ERROR);
return ret;
}
}
else
{
ret.error = true;
ret.message = "Missing External PKI alias";
return ret;
}
}
#endif
// build client options object
ClientOptions::Ptr client_options = new ClientOptions(state->options, cc);
// configure creds in options
client_options->submit_creds(state->creds);
// instantiate top-level client session
state->session.reset(new ClientConnect(*state->io_context(), client_options));
// convenience clock tick
if (state->clock_tick_ms)
{
state->clock_tick.reset(new MyClockTick(*state->io_context(), this, state->clock_tick_ms));
state->clock_tick->schedule();
}
// raise an exception if app has expired
check_app_expired();
// start VPN
state->session->start(); // queue parallel async reads
// wire up async stop
AsioStopScope scope_local(*state->io_context(), state->async_stop_local(), [this]() {
state->session->graceful_stop();
connect_attach();
#if defined(OPENVPN_OVPNCLI_ASYNC_SETUP)
openvpn_io::post(*state->io_context(), [this]() {
do_connect_async();
});
AsioStopScope scope_global(*state->io_context(), state->async_stop_global(), [this]() {
state->trigger_async_stop_local();
});
// prepare to start reactor
connect_pre_run();
// run i/o reactor
state->enable_foreign_thread_access();
in_run = true;
#else
connect_setup(status, session_started);
#endif
connect_run();
return status;
}
catch (const std::exception& e)
{
if (in_run)
if (session_started)
connect_session_stop();
ret.error = true;
ret.message = Unicode::utf8_printable<std::string>(e.what(), 256);
// if exception is an ExceptionCode, translate the code
// to return status string
{
const ExceptionCode *ec = dynamic_cast<const ExceptionCode *>(&e);
if (ec && ec->code_defined())
ret.status = Error::name(ec->code());
}
return status_from_exception(e);
}
}
OPENVPN_CLIENT_EXPORT void OpenVPNClient::do_connect_async()
{
enum StopType {
NONE,
SESSION,
EXPLICIT,
};
StopType stop_type = NONE;
Status status;
bool session_started = false;
try {
connect_setup(status, session_started);
}
catch (const std::exception& e)
{
stop_type = session_started ? SESSION : EXPLICIT;
status = status_from_exception(e);
}
if (status.error)
{
ClientEvent::Base::Ptr ev = new ClientEvent::ClientSetup(status.status, status.message);
state->events->add_event(std::move(ev));
}
if (stop_type == SESSION)
connect_session_stop();
#ifdef OPENVPN_IO_REQUIRES_STOP
if (stop_type == EXPLICIT)
state->io_context()->stop();
#endif
}
OPENVPN_CLIENT_EXPORT void OpenVPNClient::connect_setup(Status& status, bool& session_started)
{
// set global MbedTLS debug level
#if defined(USE_MBEDTLS) || defined(USE_MBEDTLS_APPLE_HYBRID)
mbedtls_debug_set_threshold(state->ssl_debug_level); // fixme -- using a global method for this seems wrong
#endif
// load options
ClientOptions::Config cc;
cc.cli_stats = state->stats;
cc.cli_events = state->events;
cc.server_override = state->server_override;
cc.port_override = state->port_override;
cc.proto_override = state->proto_override;
cc.ipv6 = state->ipv6;
cc.conn_timeout = state->conn_timeout;
cc.tun_persist = state->tun_persist;
cc.google_dns_fallback = state->google_dns_fallback;
cc.synchronous_dns_lookup = state->synchronous_dns_lookup;
cc.autologin_sessions = state->autologin_sessions;
cc.proto_context_options = state->proto_context_options;
cc.http_proxy_options = state->http_proxy_options;
cc.alt_proxy = state->alt_proxy;
cc.dco = state->dco;
cc.echo = state->echo;
cc.info = state->info;
cc.reconnect_notify = &state->reconnect_notify;
if (remote_override_enabled())
cc.remote_override = &state->remote_override;
cc.private_key_password = state->private_key_password;
cc.disable_client_cert = state->disable_client_cert;
cc.ssl_debug_level = state->ssl_debug_level;
cc.default_key_direction = state->default_key_direction;
cc.force_aes_cbc_ciphersuites = state->force_aes_cbc_ciphersuites;
cc.tls_version_min_override = state->tls_version_min_override;
cc.tls_cert_profile_override = state->tls_cert_profile_override;
cc.gui_version = state->gui_version;
cc.extra_peer_info = state->extra_peer_info;
cc.stop = state->async_stop_local();
#ifdef OPENVPN_GREMLIN
cc.gremlin_config = state->gremlin_config;
#endif
#if defined(USE_TUN_BUILDER)
cc.socket_protect = &state->socket_protect;
cc.builder = this;
#endif
#if defined(OPENVPN_EXTERNAL_TUN_FACTORY)
cc.extern_tun_factory = this;
#endif
#if defined(OPENVPN_EXTERNAL_TRANSPORT_FACTORY)
cc.extern_transport_factory = this;
#endif
// force Session ID use and disable password cache if static challenge is enabled
if (state->creds
&& !state->creds->get_replace_password_with_session_id()
&& !state->eval.autologin
&& !state->eval.staticChallenge.empty())
{
state->creds->set_replace_password_with_session_id(true);
state->creds->enable_password_cache(false);
}
// external PKI
#if !defined(USE_APPLE_SSL)
if (state->eval.externalPki && !state->disable_client_cert)
{
if (!state->external_pki_alias.empty())
{
ExternalPKICertRequest req;
req.alias = state->external_pki_alias;
external_pki_cert_request(req);
if (!req.error)
{
cc.external_pki = this;
process_epki_cert_chain(req);
}
else
{
external_pki_error(req, Error::EPKI_CERT_ERROR);
return;
}
}
else
{
status.error = true;
status.message = "Missing External PKI alias";
return;
}
}
#endif
// build client options object
ClientOptions::Ptr client_options = new ClientOptions(state->options, cc);
// configure creds in options
client_options->submit_creds(state->creds);
// instantiate top-level client session
state->session.reset(new ClientConnect(*state->io_context(), client_options));
// convenience clock tick
if (state->clock_tick_ms)
{
state->clock_tick.reset(new MyClockTick(*state->io_context(), this, state->clock_tick_ms));
state->clock_tick->schedule();
}
// raise an exception if app has expired
check_app_expired();
// start VPN
state->session->start(); // queue reads on socket/tun
session_started = true;
// wire up async stop
state->setup_async_stop_scopes();
// prepare to start reactor
connect_pre_run();
state->enable_foreign_thread_access();
}
OPENVPN_CLIENT_EXPORT Status OpenVPNClient::status_from_exception(const std::exception& e)
{
Status ret;
ret.error = true;
ret.message = Unicode::utf8_printable<std::string>(e.what(), 256);
// if exception is an ExceptionCode, translate the code
// to return status string
{
const ExceptionCode *ec = dynamic_cast<const ExceptionCode *>(&e);
if (ec && ec->code_defined())
ret.status = Error::name(ec->code());
}
return ret;
}
@@ -1293,10 +1357,5 @@ namespace openvpn {
{
delete state;
}
OPENVPN_CLIENT_EXPORT LogInfo::LogInfo(std::string str)
: text(std::move(str))
{
}
}
}

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.
@@ -24,6 +24,9 @@
// The crux of the API is defined in OpenVPNClient (below)
// and TunBuilderBase.
#ifndef OVPNCLI_HPP
#define OVPNCLI_HPP
#include <string>
#include <vector>
#include <utility>
@@ -31,6 +34,7 @@
#include <openvpn/tun/builder/base.hpp>
#include <openvpn/tun/extern/fw.hpp>
#include <openvpn/pki/epkibase.hpp>
#include <openvpn/transport/client/extern/fw.hpp>
namespace openvpn {
class OptionList;
@@ -172,6 +176,10 @@ namespace openvpn {
// option of profile
std::string serverOverride;
// Use a different port than that specified in "remote"
// option of profile
std::string portOverride;
// Force a given transport protocol
// Should be tcp, udp, or adaptive.
std::string protoOverride;
@@ -192,6 +200,9 @@ namespace openvpn {
// DNS servers, use the standard Google DNS servers.
bool googleDnsFallback = false;
// if true, do synchronous DNS lookup.
bool synchronousDnsLookup = false;
// Enable autologin sessions
bool autologinSessions = true;
@@ -321,7 +332,8 @@ namespace openvpn {
struct LogInfo
{
LogInfo() {}
LogInfo(std::string str);
LogInfo(std::string str)
: text(std::move(str)) {}
std::string text; // log output (usually but not always one line)
};
@@ -412,6 +424,7 @@ namespace openvpn {
class OpenVPNClient : public TunBuilderBase, // expose tun builder virtual methods
public LogReceiver, // log message notification
public ExternalTun::Factory, // low-level tun override
public ExternalTransport::Factory,// low-level transport override
private ExternalPKIBase
{
public:
@@ -567,10 +580,13 @@ namespace openvpn {
Private::ClientState* state;
private:
void connect_setup(Status&, bool&);
void do_connect_async();
static Status status_from_exception(const std::exception&);
static void parse_config(const Config&, EvalConfig&, OptionList&);
void parse_extras(const Config&, EvalConfig&);
void external_pki_error(const ExternalPKIRequestBase&, const size_t err_type);
void process_epki_cert_chain(const ExternalPKICertRequest& req);
void external_pki_error(const ExternalPKIRequestBase&, const size_t);
void process_epki_cert_chain(const ExternalPKICertRequest&);
void check_app_expired();
static MergeConfig build_merge_config(const ProfileMerge&);
@@ -587,3 +603,5 @@ namespace openvpn {
}
}
#endif

View File

@@ -5,11 +5,29 @@ if [ -z "$O3" ]; then
echo O3 var must point to ovpn3 tree
exit 1
fi
[ -z "$DL" ] && DL=~/Downloads
if [ -z "$DEP_DIR" ]; then
echo DEP_DIR var must point to dependency build folder
exit 1
fi
if [ -z "$DL" ]; then
echo DL var must point to the download folder
exit 1
fi
. $O3/core/deps/lib-versions
# source helper functions
. $O3/core/deps/functions.sh
PACKAGE=${ASIO_VERSION}
FNAME=${ASIO_VERSION}.tar.gz
PV=${ASIO_VERSION#*-}
URL=https://github.com/chriskohlhoff/asio/archive/${PV}.tar.gz
CSUM=${ASIO_CSUM}
download
cd $DEP_DIR
rm -rf asio*
tar xf $DL/$ASIO_VERSION.tar.gz
cp -a $ASIO_VERSION asio

View File

@@ -0,0 +1,30 @@
function check_download()
{
if [ -f $DL/$FNAME ]; then
CHECK=$(sha256sum $DL/$FNAME |awk '{printf $1};')
if [ "$CHECK" == "$CSUM" ]; then
return 0
else
echo "Checksum mismatch for $FNAME. Was $CHECK, expected $CSUM"
fi
else
echo "$FNAME not found."
fi
return -1
}
function download()
{
check_download && return 0
rm -f $DL/$FNAME
if [ -n "$URL" ]; then
wget $URL -O $DL/$FNAME
else
echo URL must be specified
exit 1
fi
check_download || return -1
}

View File

@@ -1,4 +1,10 @@
export ASIO_VERSION=asio-20170301
export LZ4_VERSION=lz4-1.7.5
export MBEDTLS_VERSION=mbedtls-2.4.0
export ASIO_VERSION=asio-862aed305dcf91387535519c9549c17630339a12
export ASIO_CSUM=65eb4e0997795e4c7c76325387311c3b9d211754615c275bfe5ca6e186dc322b
export LZ4_VERSION=lz4-1.8.0
export LZ4_CSUM=2ca482ea7a9bb103603108b5a7510b7592b90158c151ff50a28f1ca8389fccf6
export MBEDTLS_VERSION=mbedtls-2.6.0
export MBEDTLS_CSUM=99bc9d4212d3d885eeb96273bcde8ecc649a481404b8d7ea7bb26397c9909687
export OPENSSL_VERSION=openssl-1.0.2h

View File

@@ -5,17 +5,33 @@ if [ -z "$O3" ]; then
echo O3 var must point to ovpn3 tree
exit 1
fi
if [ -z "$DEP_DIR" ]; then
echo DEP_DIR var must point to dependency build folder
exit 1
fi
if [ -z "$DL" ]; then
echo DL var must point to the download folder
exit 1
fi
if [ -z "$TARGET" ]; then
echo TARGET var must be defined
exit 1
fi
[ -z "$DL" ] && DL=~/Downloads
# source vars
. $O3/core/vars/vars-${TARGET}
. $O3/core/deps/lib-versions
# source helper functions
. $O3/core/deps/functions.sh
FNAME=${LZ4_VERSION}.tar.gz
PN=${LZ4_VERSION#*-}
URL=https://github.com/lz4/lz4/archive/v${PN}.tar.gz
CSUM=${LZ4_CSUM}
download
CC=cc
LD=ld

View File

@@ -5,6 +5,15 @@ if [ -z "$O3" ]; then
echo O3 var must point to ovpn3 tree
exit 1
fi
if [ -z "$DEP_DIR" ]; then
echo DEP_DIR var must point to dependency build folder
exit 1
fi
if [ -z "$DL" ]; then
echo DL var must point to the download folder
exit 1
fi
if [ -z "$TARGET" ]; then
echo TARGET var must be defined
exit 1
@@ -14,6 +23,16 @@ fi
. $O3/core/vars/vars-${TARGET}
. $O3/core/deps/lib-versions
# source helper functions
. $O3/core/deps/functions.sh
FNAME=${MBEDTLS_VERSION}-apache.tgz
PN=${MBEDTLS_VERSION#*-}
URL=https://tls.mbed.org/download/$MBEDTLS_VERSION-apache.tgz
CSUM=${MBEDTLS_CSUM}
download
# put build targets here
DIST=$(pwd)/mbedtls/mbedtls-$PLATFORM
rm -rf $DIST
@@ -31,6 +50,11 @@ else
# enable MD4 (needed for NTLM auth)
perl -pi -e 's/^\/\/// if /#define MBEDTLS_MD4_C/' include/mbedtls/config.h
# apply pre-generated patches
for file in $O3/core/deps/mbedtls/patches/*.patch; do
patch -p1 <$file
done
fi
# compiler vars
@@ -48,7 +72,8 @@ SRC=$(pwd)
cd library
rm -f *.o
for c in *.c ; do
CMD="$CC -I../include $PLATFORM_FLAGS $OTHER_COMPILER_FLAGS $LIB_OPT_LEVEL $LIB_FPIC -c $c"
CMD="$CC -I../include -DMBEDTLS_RELAXED_X509_DATE \
$PLATFORM_FLAGS $OTHER_COMPILER_FLAGS $LIB_OPT_LEVEL $LIB_FPIC -c $c"
echo $CMD
$CMD
done

View File

@@ -0,0 +1,41 @@
diff -urw mbedtls-2.6.0.orig/library/x509.c mbedtls-2.6.0/library/x509.c
--- mbedtls-2.6.0.orig/library/x509.c 2017-11-03 11:46:21.403848065 +0800
+++ mbedtls-2.6.0/library/x509.c 2017-11-03 11:58:46.259817520 +0800
@@ -559,13 +559,20 @@
/*
* Parse seconds if present
*/
- if ( len >= 2 )
+ if ( len >= 2 && **p >= '0' && **p <= '9' )
{
CHECK( x509_parse_int( p, 2, &tm->sec ) );
len -= 2;
}
else
+ {
+#if defined(MBEDTLS_RELAXED_X509_DATE)
+ /* if relaxed mode, allow seconds to be absent */
+ tm->sec = 0;
+#else
return ( MBEDTLS_ERR_X509_INVALID_DATE );
+#endif
+ }
/*
* Parse trailing 'Z' if present
@@ -575,6 +582,15 @@
(*p)++;
len--;
}
+#if defined(MBEDTLS_RELAXED_X509_DATE)
+ else if ( len == 5 && **p == '+' )
+ {
+ int tz; /* throwaway timezone */
+ (*p)++;
+ CHECK( x509_parse_int( p, 4, &tz ) );
+ return 0;
+ }
+#endif
/*
* We should have parsed all characters at this point

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -31,8 +31,9 @@ fi
echo SWIG
swig -c++ -java -package $pkg -I$O3/core/client -I$O3/core ovpncli.i
# fixme: removed "android" from TARGET list due to compile failures in Asio
for TARGET in android-a8a android-a7a ; do
TARGETS=${TARGETS:-android-a7a android-a8a android-x86}
for TARGET in $TARGETS; do
if [ "$DEBUG_BUILD" = "1" ]; then
. ../vars/vars-${TARGET}-dbg
@@ -58,10 +59,13 @@ else
ssl_libdir="-L$DEP_DIR/mbedtls/mbedtls-$PLATFORM/library"
fi
[ -z "$GPP_CMD" ] && GPP_CMD=g++
echo CORE $ABI
g++ \
$GPP_CMD \
$CXX_COMPILER_FLAGS \
$PLATFORM_FLAGS \
$OTHER_COMPILER_FLAGS \
$LIB_OPT_LEVEL $LIB_FPIC \
-Wall -Wno-sign-compare -Wno-unused-parameter \
-Wno-unused-local-typedefs \
@@ -71,6 +75,7 @@ g++ \
-DASIO_STANDALONE \
-DASIO_NO_DEPRECATED \
-DHAVE_LZ4 \
-DOPENVPN_USE_TLS_MD5 \
-I$O3/core/client \
-I$O3/core \
$common \
@@ -80,9 +85,10 @@ g++ \
-c $O3/core/client/ovpncli.cpp
echo WRAP $ABI
g++ \
$GPP_CMD \
$CXX_COMPILER_FLAGS \
$PLATFORM_FLAGS \
$OTHER_COMPILER_FLAGS \
$opt2 $LIB_FPIC \
-fno-strict-aliasing \
-Wall \
@@ -112,5 +118,8 @@ mv libovpncli.so build/libs/$ABI/
rm ovpncli.o
done
mv ovpncli.java ovpncliJNI.java SWIGTYPE_*.java ClientAPI_*.java build/
mv ovpncli_wrap.cxx ovpncli_wrap.h ovpncli.java ovpncliJNI.java SWIGTYPE_*.java ClientAPI_*.java build/
git clean -q -fX .
tar -czf android-core-build.tgz build
mv android-core-build.tgz $O3/

View File

@@ -54,7 +54,7 @@ g++ \
$CXX_COMPILER_FLAGS \
$PLATFORM_FLAGS \
$LIB_OPT_LEVEL $LIB_FPIC \
-Wall -Wno-sign-compare -Wno-unused-parameter \
-Wall -Werror -Wno-sign-compare -Wno-unused-parameter \
-Wno-unused-local-typedefs \
$vis1 \
$ssl_def \
@@ -75,7 +75,7 @@ g++ \
$PLATFORM_FLAGS \
$opt2 $LIB_FPIC \
-fno-strict-aliasing \
-Wall \
-Wall -Werror \
$vis1 $vis2 \
-I$O3/core/client \
-I$O3/core \

View File

@@ -15,6 +15,7 @@
// ignore these ClientAPI::OpenVPNClient bases
%ignore openvpn::ClientAPI::LogReceiver;
%ignore openvpn::ExternalTun::Factory;
%ignore openvpn::ExternalTransport::Factory;
// modify exported C++ class names to incorporate their enclosing namespace
%rename(ClientAPI_OpenVPNClient) OpenVPNClient;
@@ -49,4 +50,5 @@ namespace std {
%include "openvpn/pki/epkibase.hpp"
%include "openvpn/tun/builder/base.hpp"
%import "openvpn/tun/extern/fw.hpp" // ignored
%import "openvpn/transport/client/extern/fw.hpp" // ignored
%include "ovpncli.hpp"

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.
@@ -148,19 +148,19 @@ namespace openvpn {
throw ip_exception("address unspecified");
}
static Addr from_ipv4(const IPv4::Addr& addr)
static Addr from_ipv4(IPv4::Addr addr)
{
Addr a;
a.ver = V4;
a.u.v4 = addr;
a.u.v4 = std::move(addr);
return a;
}
static Addr from_ipv6(const IPv6::Addr& addr)
static Addr from_ipv6(IPv6::Addr addr)
{
Addr a;
a.ver = V6;
a.u.v6 = addr;
a.u.v6 = std::move(addr);
return a;
}
@@ -327,6 +327,22 @@ namespace openvpn {
throw ip_exception("address unspecified");
}
// validate the prefix length for the IP version
static bool validate_prefix_len(Version v, const unsigned int prefix_len)
{
if (v == V4)
{
if (prefix_len <= V4_SIZE)
return true;
}
else if (v == V6)
{
if (prefix_len <= V6_SIZE)
return true;
}
return false;
}
// build a netmask using given prefix_len
static Addr netmask_from_prefix_len(Version v, const unsigned int prefix_len)
{
@@ -837,23 +853,31 @@ namespace openvpn {
return 0;
}
std::size_t hashval() const
template <typename HASH>
void hash(HASH& h) const
{
std::size_t seed = 0;
switch (ver)
{
case Addr::V4:
Hash::combine(seed, 4, u.v4);
u.v4.hash(h);
break;
case Addr::V6:
Hash::combine(seed, 6, u.v6);
u.v6.hash(h);
break;
default:
break;
}
return seed;
}
#ifdef HAVE_CITYHASH
std::size_t hashval() const
{
HashSizeT h;
hash(h);
return h.value();
}
#endif
#ifdef OPENVPN_IP_IMMUTABLE
private:
#endif
@@ -951,6 +975,8 @@ namespace openvpn {
}
}
#ifdef HAVE_CITYHASH
OPENVPN_HASH_METHOD(openvpn::IP::Addr, hashval);
#endif
#endif

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.
@@ -35,7 +35,6 @@
#include <openvpn/common/socktypes.hpp>
#include <openvpn/common/ffs.hpp>
#include <openvpn/common/hexstr.hpp>
#include <openvpn/common/hash.hpp>
#include <openvpn/addr/iperr.hpp>
namespace openvpn {
@@ -85,12 +84,12 @@ namespace openvpn {
return ret;
}
struct sockaddr_in to_sockaddr() const
struct sockaddr_in to_sockaddr(const unsigned short port=0) const
{
struct sockaddr_in ret;
std::memset(&ret, 0, sizeof(ret));
ret.sin_family = AF_INET;
ret.sin_port = 0;
ret.sin_port = htons(port);
ret.sin_addr.s_addr = htonl(u.addr);
return ret;
}
@@ -493,9 +492,10 @@ namespace openvpn {
return SIZE;
}
std::size_t hashval() const
template <typename HASH>
void hash(HASH& h) const
{
return Hash::value(u.addr);
h(u.addr);
}
#ifdef OPENVPN_IP_IMMUTABLE
@@ -566,6 +566,4 @@ namespace openvpn {
}
}
OPENVPN_HASH_METHOD(openvpn::IPv4::Addr, hashval);
#endif // OPENVPN_ADDR_IPV4_H

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.
@@ -34,7 +34,6 @@
#include <openvpn/common/socktypes.hpp>
#include <openvpn/common/ffs.hpp>
#include <openvpn/common/hexstr.hpp>
#include <openvpn/common/hash.hpp>
#include <openvpn/addr/ipv4.hpp>
#include <openvpn/addr/iperr.hpp>
@@ -84,12 +83,12 @@ namespace openvpn {
return ret;
}
struct sockaddr_in6 to_sockaddr() const
struct sockaddr_in6 to_sockaddr(const unsigned short port=0) const
{
struct sockaddr_in6 ret;
std::memset(&ret, 0, sizeof(ret));
ret.sin6_family = AF_INET6;
ret.sin6_port = 0;
ret.sin6_port = htons(port);
host_to_network_order((union ipv6addr *)&ret.sin6_addr.s6_addr, &u);
ret.sin6_scope_id = scope_id_;
return ret;
@@ -535,9 +534,10 @@ namespace openvpn {
return SIZE;
}
std::size_t hashval() const
template <typename HASH>
void hash(HASH& h) const
{
return Hash::value(u.u32[0], u.u32[1], u.u32[2], u.u32[3]);
h(u.bytes, sizeof(u.bytes));
}
#ifdef OPENVPN_IP_IMMUTABLE
@@ -825,6 +825,4 @@ namespace openvpn {
}
}
OPENVPN_HASH_METHOD(openvpn::IPv6::Addr, hashval);
#endif // OPENVPN_ADDR_IPV6_H

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -1,3 +1,24 @@
// OpenVPN -- An application to securely tunnel IP networks
// over a single port, with support for SSL/TLS-based
// session authentication and key exchange,
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.
// Regular expressions for IPv4/v6
// Source: http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.
@@ -123,6 +123,14 @@ namespace openvpn {
return addr.defined() && prefix_len == addr.size();
}
unsigned int host_bits() const
{
if (prefix_len < addr.size())
return addr.size() - prefix_len;
else
return 0;
}
bool contains(const ADDR& a) const // assumes canonical address/routes
{
if (addr.defined() && addr.version() == a.version())
@@ -167,10 +175,21 @@ namespace openvpn {
return prefix_len == other.prefix_len && addr == other.addr;
}
template <typename HASH>
void hash(HASH& h) const
{
addr.hash(h);
h(prefix_len);
}
#ifdef HAVE_CITYHASH
std::size_t hash_value() const
{
return Hash::value(addr, prefix_len);
HashSizeT h;
hash(h);
return h.value();
}
#endif
};
template <typename ADDR>
@@ -253,8 +272,10 @@ namespace openvpn {
}
}
#ifdef HAVE_CITYHASH
OPENVPN_HASH_METHOD(openvpn::IP::Route, hash_value);
OPENVPN_HASH_METHOD(openvpn::IP::Route4, hash_value);
OPENVPN_HASH_METHOD(openvpn::IP::Route6, hash_value);
#endif
#endif

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

View File

@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc.
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.

Some files were not shown because too many files have changed in this diff Show More