Make default VPN configuration mutable

This commit is contained in:
Davide De Rosa 2019-03-21 19:24:27 +01:00
parent 1cb315b44c
commit 9f6307dbc2
2 changed files with 5 additions and 5 deletions

View File

@ -47,7 +47,7 @@ public class AppConstants {
} }
public class VPN { public class VPN {
public static func baseConfiguration() -> TunnelKitProvider.Configuration { public static var baseConfiguration: TunnelKitProvider.ConfigurationBuilder = {
let sessionBuilder = SessionProxy.ConfigurationBuilder(ca: CryptoContainer(pem: "")) let sessionBuilder = SessionProxy.ConfigurationBuilder(ca: CryptoContainer(pem: ""))
var builder = TunnelKitProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build()) var builder = TunnelKitProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build())
builder.mtu = 1250 builder.mtu = 1250
@ -55,8 +55,8 @@ public class AppConstants {
// builder.debugLogFormat = "$Dyyyy-MM-dd HH:mm:ss.SSS$d $L $N.$F:$l - $M" // builder.debugLogFormat = "$Dyyyy-MM-dd HH:mm:ss.SSS$d $L $N.$F:$l - $M"
// builder.debugLogFormat = "$DHH:mm:ss$d $N.$F:$l - $M" // builder.debugLogFormat = "$DHH:mm:ss$d $N.$F:$l - $M"
builder.debugLogFormat = Log.debugFormat builder.debugLogFormat = Log.debugFormat
return builder.build() return builder
} }()
private static let connectivityStrings: [String] = [ private static let connectivityStrings: [String] = [
"https://www.amazon.com", "https://www.amazon.com",

View File

@ -56,7 +56,7 @@ public class TransientStore {
// this must be graceful // this must be graceful
ConnectionService.migrateJSON(from: TransientStore.serviceURL, to: TransientStore.serviceURL) ConnectionService.migrateJSON(from: TransientStore.serviceURL, to: TransientStore.serviceURL)
let cfg = AppConstants.VPN.baseConfiguration() let cfg = AppConstants.VPN.baseConfiguration.build()
do { do {
let data = try Data(contentsOf: TransientStore.serviceURL) let data = try Data(contentsOf: TransientStore.serviceURL)
if let content = String(data: data, encoding: .utf8) { if let content = String(data: data, encoding: .utf8) {