Move builder() to extension

This commit is contained in:
Davide De Rosa 2019-04-11 16:46:52 +02:00
parent 5df614b5e2
commit 26cec205a7
1 changed files with 35 additions and 30 deletions

View File

@ -334,36 +334,6 @@ extension SessionProxy {
/// - Seealso: `SessionProxy.ConfigurationBuilder.searchDomain`
public let searchDomain: String?
/**
Returns a `SessionProxy.ConfigurationBuilder` to use this configuration as a starting point for a new one.
- Returns: An editable `SessionProxy.ConfigurationBuilder` initialized with this configuration.
*/
public func builder() -> SessionProxy.ConfigurationBuilder {
var builder = SessionProxy.ConfigurationBuilder()
builder.cipher = cipher
builder.digest = digest
builder.compressionFraming = compressionFraming
builder.compressionAlgorithm = compressionAlgorithm
builder.ca = ca
builder.clientCertificate = clientCertificate
builder.clientKey = clientKey
builder.tlsWrap = tlsWrap
builder.keepAliveInterval = keepAliveInterval
builder.renegotiatesAfter = renegotiatesAfter
builder.endpointProtocols = endpointProtocols
builder.checksEKU = checksEKU
builder.randomizeEndpoint = randomizeEndpoint
builder.usesPIAPatches = usesPIAPatches
builder.authToken = authToken
builder.peerId = peerId
builder.ipv4 = ipv4
builder.ipv6 = ipv6
builder.dnsServers = dnsServers
builder.searchDomain = searchDomain
return builder
}
// MARK: Shortcuts
/// :nodoc:
@ -383,6 +353,41 @@ extension SessionProxy {
}
}
// MARK: Modification
extension SessionProxy.Configuration {
/**
Returns a `SessionProxy.ConfigurationBuilder` to use this configuration as a starting point for a new one.
- Returns: An editable `SessionProxy.ConfigurationBuilder` initialized with this configuration.
*/
public func builder() -> SessionProxy.ConfigurationBuilder {
var builder = SessionProxy.ConfigurationBuilder()
builder.cipher = cipher
builder.digest = digest
builder.compressionFraming = compressionFraming
builder.compressionAlgorithm = compressionAlgorithm
builder.ca = ca
builder.clientCertificate = clientCertificate
builder.clientKey = clientKey
builder.tlsWrap = tlsWrap
builder.keepAliveInterval = keepAliveInterval
builder.renegotiatesAfter = renegotiatesAfter
builder.endpointProtocols = endpointProtocols
builder.checksEKU = checksEKU
builder.randomizeEndpoint = randomizeEndpoint
builder.usesPIAPatches = usesPIAPatches
builder.authToken = authToken
builder.peerId = peerId
builder.ipv4 = ipv4
builder.ipv6 = ipv6
builder.dnsServers = dnsServers
builder.searchDomain = searchDomain
return builder
}
}
/// Encapsulates the IPv4 settings for the tunnel.
public struct IPv4Settings: Codable, CustomStringConvertible {