From 1c1547fc8f76b3108825410eb35f517b9b8b3dba Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 3 Mar 2019 10:51:36 +0100 Subject: [PATCH] Fix DNS servers not serialized to AppExtension --- .../AppExtension/TunnelKitProvider+Configuration.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/TunnelKit/Sources/AppExtension/TunnelKitProvider+Configuration.swift b/TunnelKit/Sources/AppExtension/TunnelKitProvider+Configuration.swift index 83c489f..47bdbec 100644 --- a/TunnelKit/Sources/AppExtension/TunnelKitProvider+Configuration.swift +++ b/TunnelKit/Sources/AppExtension/TunnelKitProvider+Configuration.swift @@ -188,6 +188,7 @@ extension TunnelKitProvider { sessionConfigurationBuilder.keepAliveInterval = providerConfiguration[S.keepAlive] as? TimeInterval sessionConfigurationBuilder.renegotiatesAfter = providerConfiguration[S.renegotiatesAfter] as? TimeInterval sessionConfigurationBuilder.usesPIAPatches = providerConfiguration[S.usesPIAPatches] as? Bool ?? false + sessionConfigurationBuilder.dnsServers = providerConfiguration[S.dnsServers] as? [String] sessionConfiguration = sessionConfigurationBuilder.build() shouldDebug = providerConfiguration[S.debug] as? Bool ?? false @@ -255,6 +256,8 @@ extension TunnelKitProvider { static let usesPIAPatches = "UsesPIAPatches" + static let dnsServers = "DNSServers" + // MARK: Debugging static let debug = "Debug" @@ -417,6 +420,9 @@ extension TunnelKitProvider { if let usesPIAPatches = sessionConfiguration.usesPIAPatches { dict[S.usesPIAPatches] = usesPIAPatches } + if let dnsServers = sessionConfiguration.dnsServers { + dict[S.dnsServers] = dnsServers + } if let debugLogFormat = debugLogFormat { dict[S.debugLogFormat] = debugLogFormat } @@ -488,6 +494,9 @@ extension TunnelKitProvider { } else { log.info("\tTLS wrapping: disabled") } + if let dnsServers = sessionConfiguration.dnsServers { + log.info("\tCustom DNS servers: \(dnsServers.maskedDescription)") + } log.info("\tDebug: \(shouldDebug)") } }