Add SessionProxy.Configuration.randomizeEndpoint
This commit is contained in:
parent
9c0205614b
commit
42227fcc00
@ -67,7 +67,8 @@ extension TunnelKitProvider {
|
|||||||
keepAliveInterval: nil,
|
keepAliveInterval: nil,
|
||||||
renegotiatesAfter: nil,
|
renegotiatesAfter: nil,
|
||||||
usesPIAPatches: nil,
|
usesPIAPatches: nil,
|
||||||
dnsServers: nil
|
dnsServers: nil,
|
||||||
|
randomizeEndpoint: false
|
||||||
),
|
),
|
||||||
shouldDebug: false,
|
shouldDebug: false,
|
||||||
debugLogFormat: nil,
|
debugLogFormat: nil,
|
||||||
@ -186,10 +187,11 @@ extension TunnelKitProvider {
|
|||||||
throw ProviderConfigurationError.parameter(name: "protocolConfiguration.providerConfiguration[\(S.tlsWrap)]")
|
throw ProviderConfigurationError.parameter(name: "protocolConfiguration.providerConfiguration[\(S.tlsWrap)]")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sessionConfigurationBuilder.keepAliveInterval = providerConfiguration[S.keepAlive] as? TimeInterval
|
sessionConfigurationBuilder.keepAliveInterval = providerConfiguration[S.keepAlive] as? TimeInterval ?? ConfigurationBuilder.defaults.sessionConfiguration.keepAliveInterval
|
||||||
sessionConfigurationBuilder.renegotiatesAfter = providerConfiguration[S.renegotiatesAfter] as? TimeInterval
|
sessionConfigurationBuilder.renegotiatesAfter = providerConfiguration[S.renegotiatesAfter] as? TimeInterval ?? ConfigurationBuilder.defaults.sessionConfiguration.renegotiatesAfter
|
||||||
sessionConfigurationBuilder.usesPIAPatches = providerConfiguration[S.usesPIAPatches] as? Bool ?? false
|
sessionConfigurationBuilder.usesPIAPatches = providerConfiguration[S.usesPIAPatches] as? Bool ?? ConfigurationBuilder.defaults.sessionConfiguration.usesPIAPatches
|
||||||
sessionConfigurationBuilder.dnsServers = providerConfiguration[S.dnsServers] as? [String]
|
sessionConfigurationBuilder.dnsServers = providerConfiguration[S.dnsServers] as? [String]
|
||||||
|
sessionConfigurationBuilder.randomizeEndpoint = providerConfiguration[S.randomizeEndpoint] as? Bool ?? ConfigurationBuilder.defaults.sessionConfiguration.randomizeEndpoint
|
||||||
sessionConfiguration = sessionConfigurationBuilder.build()
|
sessionConfiguration = sessionConfigurationBuilder.build()
|
||||||
|
|
||||||
shouldDebug = providerConfiguration[S.debug] as? Bool ?? ConfigurationBuilder.defaults.shouldDebug
|
shouldDebug = providerConfiguration[S.debug] as? Bool ?? ConfigurationBuilder.defaults.shouldDebug
|
||||||
@ -261,6 +263,8 @@ extension TunnelKitProvider {
|
|||||||
|
|
||||||
static let dnsServers = "DNSServers"
|
static let dnsServers = "DNSServers"
|
||||||
|
|
||||||
|
static let randomizeEndpoint = "RandomizeEndpoint"
|
||||||
|
|
||||||
// MARK: Debugging
|
// MARK: Debugging
|
||||||
|
|
||||||
static let debug = "Debug"
|
static let debug = "Debug"
|
||||||
@ -426,6 +430,9 @@ extension TunnelKitProvider {
|
|||||||
if let dnsServers = sessionConfiguration.dnsServers {
|
if let dnsServers = sessionConfiguration.dnsServers {
|
||||||
dict[S.dnsServers] = dnsServers
|
dict[S.dnsServers] = dnsServers
|
||||||
}
|
}
|
||||||
|
if let randomizeEndpoint = sessionConfiguration.randomizeEndpoint {
|
||||||
|
dict[S.randomizeEndpoint] = randomizeEndpoint
|
||||||
|
}
|
||||||
if let debugLogFormat = debugLogFormat {
|
if let debugLogFormat = debugLogFormat {
|
||||||
dict[S.debugLogFormat] = debugLogFormat
|
dict[S.debugLogFormat] = debugLogFormat
|
||||||
}
|
}
|
||||||
@ -508,6 +515,9 @@ extension TunnelKitProvider {
|
|||||||
if let dnsServers = sessionConfiguration.dnsServers {
|
if let dnsServers = sessionConfiguration.dnsServers {
|
||||||
log.info("\tCustom DNS servers: \(dnsServers.maskedDescription)")
|
log.info("\tCustom DNS servers: \(dnsServers.maskedDescription)")
|
||||||
}
|
}
|
||||||
|
if sessionConfiguration.randomizeEndpoint ?? false {
|
||||||
|
log.info("\tRandomize endpoint: true")
|
||||||
|
}
|
||||||
log.info("\tDebug: \(shouldDebug)")
|
log.info("\tDebug: \(shouldDebug)")
|
||||||
log.info("\tMasks private data: \(masksPrivateData ?? true)")
|
log.info("\tMasks private data: \(masksPrivateData ?? true)")
|
||||||
}
|
}
|
||||||
|
@ -174,6 +174,9 @@ extension SessionProxy {
|
|||||||
/// Optionally override the server DNS entries.
|
/// Optionally override the server DNS entries.
|
||||||
public var dnsServers: [String]?
|
public var dnsServers: [String]?
|
||||||
|
|
||||||
|
/// Optionally randomize endpoint order.
|
||||||
|
public var randomizeEndpoint: Bool?
|
||||||
|
|
||||||
/// :nodoc:
|
/// :nodoc:
|
||||||
public init(ca: CryptoContainer) {
|
public init(ca: CryptoContainer) {
|
||||||
cipher = .aes128cbc
|
cipher = .aes128cbc
|
||||||
@ -189,6 +192,7 @@ extension SessionProxy {
|
|||||||
renegotiatesAfter = nil
|
renegotiatesAfter = nil
|
||||||
usesPIAPatches = false
|
usesPIAPatches = false
|
||||||
dnsServers = nil
|
dnsServers = nil
|
||||||
|
randomizeEndpoint = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -210,7 +214,8 @@ extension SessionProxy {
|
|||||||
keepAliveInterval: keepAliveInterval,
|
keepAliveInterval: keepAliveInterval,
|
||||||
renegotiatesAfter: renegotiatesAfter,
|
renegotiatesAfter: renegotiatesAfter,
|
||||||
usesPIAPatches: usesPIAPatches,
|
usesPIAPatches: usesPIAPatches,
|
||||||
dnsServers: dnsServers
|
dnsServers: dnsServers,
|
||||||
|
randomizeEndpoint: randomizeEndpoint
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -257,6 +262,9 @@ extension SessionProxy {
|
|||||||
/// - Seealso: `SessionProxy.ConfigurationBuilder.dnsServers`
|
/// - Seealso: `SessionProxy.ConfigurationBuilder.dnsServers`
|
||||||
public let dnsServers: [String]?
|
public let dnsServers: [String]?
|
||||||
|
|
||||||
|
/// - Seealso: `SessionProxy.ConfigurationBuilder.randomizeEndpoint`
|
||||||
|
public let randomizeEndpoint: Bool?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns a `SessionProxy.ConfigurationBuilder` to use this configuration as a starting point for a new one.
|
Returns a `SessionProxy.ConfigurationBuilder` to use this configuration as a starting point for a new one.
|
||||||
|
|
||||||
@ -276,6 +284,7 @@ extension SessionProxy {
|
|||||||
builder.renegotiatesAfter = renegotiatesAfter
|
builder.renegotiatesAfter = renegotiatesAfter
|
||||||
builder.usesPIAPatches = usesPIAPatches
|
builder.usesPIAPatches = usesPIAPatches
|
||||||
builder.dnsServers = dnsServers
|
builder.dnsServers = dnsServers
|
||||||
|
builder.randomizeEndpoint = randomizeEndpoint
|
||||||
return builder
|
return builder
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +304,8 @@ extension SessionProxy {
|
|||||||
(lhs.keepAliveInterval == rhs.keepAliveInterval) &&
|
(lhs.keepAliveInterval == rhs.keepAliveInterval) &&
|
||||||
(lhs.renegotiatesAfter == rhs.renegotiatesAfter) &&
|
(lhs.renegotiatesAfter == rhs.renegotiatesAfter) &&
|
||||||
(lhs.usesPIAPatches == rhs.usesPIAPatches) &&
|
(lhs.usesPIAPatches == rhs.usesPIAPatches) &&
|
||||||
(lhs.dnsServers == rhs.dnsServers)
|
(lhs.dnsServers == rhs.dnsServers) &&
|
||||||
|
(lhs.randomizeEndpoint == rhs.randomizeEndpoint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user