From 7c656884a20de4feb298a24590b88209e4febdd7 Mon Sep 17 00:00:00 2001 From: Sergey Abramchuk Date: Mon, 17 Aug 2020 21:23:19 +0300 Subject: [PATCH] Add new properties to the VPN profile and declare profile collection --- Tests/OpenVPNAdapter/VPNProfile.swift | 53 +++++++++------------------ 1 file changed, 17 insertions(+), 36 deletions(-) diff --git a/Tests/OpenVPNAdapter/VPNProfile.swift b/Tests/OpenVPNAdapter/VPNProfile.swift index 1383fcc..f35c5ff 100644 --- a/Tests/OpenVPNAdapter/VPNProfile.swift +++ b/Tests/OpenVPNAdapter/VPNProfile.swift @@ -11,6 +11,10 @@ import Foundation struct VPNProfile { let configuration: String + let ca: String? + let cert: String? + let key: String? + let username: String? let password: String? @@ -22,47 +26,24 @@ extension VPNProfile { static let general: VPNProfile = { let configuration: String = <#OPENVPN_CONFIGURATION#> - let username: String? = <#OPENVPN_USERNAME#> - let password: String? = <#OPENVPN_PASSWORD#> - - let settings: [String: String]? = <#OPENVPN_ADDITIONAL_SETTINGS#> - - return VPNProfile(configuration: configuration, username: username, password: password, settings: settings) - }() - - /// - static let caOnly: VPNProfile = { - let configuration: String = <#OPENVPN_CONFIGURATION#> - - let username: String? = <#OPENVPN_USERNAME#> - let password: String? = <#OPENVPN_PASSWORD#> - - let settings: [String: String]? = <#OPENVPN_ADDITIONAL_SETTINGS#> - - return VPNProfile(configuration: configuration, username: username, password: password, settings: settings) - }() - - /// - static let caWithCertAndKey: VPNProfile = { - let configuration: String = <#OPENVPN_CONFIGURATION#> + let ca: String? = <#OPENVPN_CA#> + let cert: String? = <#OPENVPN_CERT#> + let key: String? = <#OPENVPN_KEY#> let username: String? = <#OPENVPN_USERNAME#> let password: String? = <#OPENVPN_PASSWORD#> let settings: [String: String]? = <#OPENVPN_ADDITIONAL_SETTINGS#> - return VPNProfile(configuration: configuration, username: username, password: password, settings: settings) - }() - - /// - static let withoutCredentials: VPNProfile = { - let configuration: String = <#OPENVPN_CONFIGURATION#> - - let username: String? = <#OPENVPN_USERNAME#> - let password: String? = <#OPENVPN_PASSWORD#> - - let settings: [String: String]? = <#OPENVPN_ADDITIONAL_SETTINGS#> - - return VPNProfile(configuration: configuration, username: username, password: password, settings: settings) + return VPNProfile( + configuration: configuration, ca: ca, cert: cert, key: key, + username: username, password: password, settings: settings + ) }() } + +extension VPNProfile { + static let profileCollection = [ + VPNProfile.general + ] +}