Make masksPrivateData optional

Do not break Codable compatibility.
This commit is contained in:
Davide De Rosa 2019-03-21 19:31:25 +01:00
parent fad20668b0
commit ac418f414a
2 changed files with 9 additions and 5 deletions

View File

@ -100,7 +100,7 @@ extension TunnelKitProvider {
public var debugLogFormat: String? public var debugLogFormat: String?
/// Mask private data in debug log (default is `true`). /// Mask private data in debug log (default is `true`).
public var masksPrivateData: Bool public var masksPrivateData: Bool?
// MARK: Building // MARK: Building
@ -292,7 +292,7 @@ extension TunnelKitProvider {
public let debugLogFormat: String? public let debugLogFormat: String?
/// - Seealso: `TunnelKitProvider.ConfigurationBuilder.masksPrivateData` /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.masksPrivateData`
public let masksPrivateData: Bool public let masksPrivateData: Bool?
// MARK: Shortcuts // MARK: Shortcuts
@ -396,8 +396,7 @@ extension TunnelKitProvider {
S.digestAlgorithm: sessionConfiguration.digest.rawValue, S.digestAlgorithm: sessionConfiguration.digest.rawValue,
S.ca: sessionConfiguration.ca.pem, S.ca: sessionConfiguration.ca.pem,
S.mtu: mtu, S.mtu: mtu,
S.debug: shouldDebug, S.debug: shouldDebug
S.masksPrivateData: masksPrivateData
] ]
if let clientCertificate = sessionConfiguration.clientCertificate { if let clientCertificate = sessionConfiguration.clientCertificate {
dict[S.clientCertificate] = clientCertificate.pem dict[S.clientCertificate] = clientCertificate.pem
@ -430,6 +429,9 @@ extension TunnelKitProvider {
if let debugLogFormat = debugLogFormat { if let debugLogFormat = debugLogFormat {
dict[S.debugLogFormat] = debugLogFormat dict[S.debugLogFormat] = debugLogFormat
} }
if let masksPrivateData = masksPrivateData {
dict[S.masksPrivateData] = masksPrivateData
}
return dict return dict
} }

View File

@ -177,7 +177,9 @@ open class TunnelKitProvider: NEPacketTunnelProvider {
) )
// override library configuration // override library configuration
CoreConfiguration.masksPrivateData = cfg.masksPrivateData if let masksPrivateData = cfg.masksPrivateData {
CoreConfiguration.masksPrivateData = masksPrivateData
}
log.info("Starting tunnel...") log.info("Starting tunnel...")
cfg.clearLastError(in: appGroup) cfg.clearLastError(in: appGroup)