Add new properties to the VPN profile and declare profile collection

This commit is contained in:
Sergey Abramchuk
2020-08-17 21:23:19 +03:00
parent ccc3492009
commit 7c656884a2
+17 -36
View File
@@ -11,6 +11,10 @@ import Foundation
struct VPNProfile { struct VPNProfile {
let configuration: String let configuration: String
let ca: String?
let cert: String?
let key: String?
let username: String? let username: String?
let password: String? let password: String?
@@ -22,47 +26,24 @@ extension VPNProfile {
static let general: VPNProfile = { static let general: VPNProfile = {
let configuration: String = <#OPENVPN_CONFIGURATION#> let configuration: String = <#OPENVPN_CONFIGURATION#>
let username: String? = <#OPENVPN_USERNAME#> let ca: String? = <#OPENVPN_CA#>
let password: String? = <#OPENVPN_PASSWORD#> let cert: String? = <#OPENVPN_CERT#>
let key: String? = <#OPENVPN_KEY#>
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 username: String? = <#OPENVPN_USERNAME#>
let password: String? = <#OPENVPN_PASSWORD#> let password: String? = <#OPENVPN_PASSWORD#>
let settings: [String: String]? = <#OPENVPN_ADDITIONAL_SETTINGS#> 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
/// )
static let caWithCertAndKey: 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 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)
}() }()
} }
extension VPNProfile {
static let profileCollection = [
VPNProfile.general
]
}