Move Fallback into Configuration
This commit is contained in:
parent
f046bcd629
commit
6b54fd6124
|
@ -153,16 +153,6 @@ extension OpenVPN {
|
||||||
case blockLocal
|
case blockLocal
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct Fallback {
|
|
||||||
static let cipher: Cipher = .aes128cbc
|
|
||||||
|
|
||||||
static let digest: Digest = .sha1
|
|
||||||
|
|
||||||
static let compressionFraming: CompressionFraming = .disabled
|
|
||||||
|
|
||||||
static let compressionAlgorithm: CompressionAlgorithm = .disabled
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The way to create a `Configuration` object for a `OpenVPNSession`.
|
/// The way to create a `Configuration` object for a `OpenVPNSession`.
|
||||||
public struct ConfigurationBuilder {
|
public struct ConfigurationBuilder {
|
||||||
|
|
||||||
|
@ -307,10 +297,10 @@ extension OpenVPN {
|
||||||
*/
|
*/
|
||||||
public init(withFallbacks: Bool = false) {
|
public init(withFallbacks: Bool = false) {
|
||||||
if withFallbacks {
|
if withFallbacks {
|
||||||
cipher = Fallback.cipher
|
cipher = Configuration.Fallback.cipher
|
||||||
digest = Fallback.digest
|
digest = Configuration.Fallback.digest
|
||||||
compressionFraming = Fallback.compressionFraming
|
compressionFraming = Configuration.Fallback.compressionFraming
|
||||||
compressionAlgorithm = Fallback.compressionAlgorithm
|
compressionAlgorithm = Configuration.Fallback.compressionAlgorithm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,6 +356,17 @@ extension OpenVPN {
|
||||||
/// The immutable configuration for `OpenVPNSession`.
|
/// The immutable configuration for `OpenVPNSession`.
|
||||||
public struct Configuration: Codable, Equatable {
|
public struct Configuration: Codable, Equatable {
|
||||||
|
|
||||||
|
/// :nodoc:
|
||||||
|
public struct Fallback {
|
||||||
|
public static let cipher: Cipher = .aes128cbc
|
||||||
|
|
||||||
|
public static let digest: Digest = .sha1
|
||||||
|
|
||||||
|
public static let compressionFraming: CompressionFraming = .disabled
|
||||||
|
|
||||||
|
public static let compressionAlgorithm: CompressionAlgorithm = .disabled
|
||||||
|
}
|
||||||
|
|
||||||
/// - Seealso: `ConfigurationBuilder.cipher`
|
/// - Seealso: `ConfigurationBuilder.cipher`
|
||||||
public let cipher: Cipher?
|
public let cipher: Cipher?
|
||||||
|
|
||||||
|
@ -508,11 +509,11 @@ extension OpenVPN.Configuration {
|
||||||
*/
|
*/
|
||||||
public func builder(withFallbacks: Bool = false) -> OpenVPN.ConfigurationBuilder {
|
public func builder(withFallbacks: Bool = false) -> OpenVPN.ConfigurationBuilder {
|
||||||
var builder = OpenVPN.ConfigurationBuilder()
|
var builder = OpenVPN.ConfigurationBuilder()
|
||||||
builder.cipher = cipher ?? (withFallbacks ? OpenVPN.Fallback.cipher : nil)
|
builder.cipher = cipher ?? (withFallbacks ? Fallback.cipher : nil)
|
||||||
builder.dataCiphers = dataCiphers
|
builder.dataCiphers = dataCiphers
|
||||||
builder.digest = digest ?? (withFallbacks ? OpenVPN.Fallback.digest : nil)
|
builder.digest = digest ?? (withFallbacks ? Fallback.digest : nil)
|
||||||
builder.compressionFraming = compressionFraming ?? (withFallbacks ? OpenVPN.Fallback.compressionFraming : nil)
|
builder.compressionFraming = compressionFraming ?? (withFallbacks ? Fallback.compressionFraming : nil)
|
||||||
builder.compressionAlgorithm = compressionAlgorithm ?? (withFallbacks ? OpenVPN.Fallback.compressionAlgorithm : nil)
|
builder.compressionAlgorithm = compressionAlgorithm ?? (withFallbacks ? Fallback.compressionAlgorithm : nil)
|
||||||
builder.ca = ca
|
builder.ca = ca
|
||||||
builder.clientCertificate = clientCertificate
|
builder.clientCertificate = clientCertificate
|
||||||
builder.clientKey = clientKey
|
builder.clientKey = clientKey
|
||||||
|
|
Loading…
Reference in New Issue