From 26cec205a7210e64cf14dd31b10e32d302f8cdcf Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Thu, 11 Apr 2019 16:46:52 +0200 Subject: [PATCH] Move builder() to extension --- .../Core/SessionProxy+Configuration.swift | 65 ++++++++++--------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/TunnelKit/Sources/Core/SessionProxy+Configuration.swift b/TunnelKit/Sources/Core/SessionProxy+Configuration.swift index cf66b8d..34487ec 100644 --- a/TunnelKit/Sources/Core/SessionProxy+Configuration.swift +++ b/TunnelKit/Sources/Core/SessionProxy+Configuration.swift @@ -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 {