Add internal flag for masking private data
Hardcoded to true. Private data is mostly hostname/IP addresses and routing information.
This commit is contained in:
parent
fe4390e528
commit
25d84f6530
|
@ -36,6 +36,7 @@
|
|||
|
||||
import Foundation
|
||||
import __TunnelKitNative
|
||||
import CommonCrypto
|
||||
|
||||
struct CoreConfiguration {
|
||||
static let identifier = "com.algoritmico.TunnelKit"
|
||||
|
@ -59,6 +60,8 @@ struct CoreConfiguration {
|
|||
|
||||
static let logsSensitiveData = false
|
||||
|
||||
static let masksPrivateData = true
|
||||
|
||||
static let usesReplayProtection = true
|
||||
|
||||
static let tickInterval = 0.2
|
||||
|
@ -97,3 +100,17 @@ struct CoreConfiguration {
|
|||
|
||||
static let keysCount = 4
|
||||
}
|
||||
|
||||
extension CustomStringConvertible {
|
||||
var maskedDescription: String {
|
||||
guard CoreConfiguration.masksPrivateData else {
|
||||
return description
|
||||
}
|
||||
var data = description.data(using: .utf8)!
|
||||
var md = Data(count: Int(CC_SHA1_DIGEST_LENGTH))
|
||||
md.withUnsafeMutableBytes {
|
||||
_ = CC_SHA1(&data, CC_LONG(data.count), $0)
|
||||
}
|
||||
return md.toHex()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue