global: support DNS search domains
This has been supported by Windows and Linux for quite some time. Add support here for iOS and macOS. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
@@ -10,6 +10,7 @@ public struct InterfaceConfiguration {
|
||||
public var listenPort: UInt16?
|
||||
public var mtu: UInt16?
|
||||
public var dns = [DNSServer]()
|
||||
public var dnsSearch = [String]()
|
||||
|
||||
public init(privateKey: PrivateKey) {
|
||||
self.privateKey = privateKey
|
||||
@@ -25,6 +26,7 @@ extension InterfaceConfiguration: Equatable {
|
||||
lhsAddresses == rhsAddresses &&
|
||||
lhs.listenPort == rhs.listenPort &&
|
||||
lhs.mtu == rhs.mtu &&
|
||||
lhs.dns == rhs.dns
|
||||
lhs.dns == rhs.dns &&
|
||||
lhs.dnsSearch == rhs.dnsSearch
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ class PacketTunnelSettingsGenerator {
|
||||
|
||||
let dnsServerStrings = tunnelConfiguration.interface.dns.map { $0.stringRepresentation }
|
||||
let dnsSettings = NEDNSSettings(servers: dnsServerStrings)
|
||||
dnsSettings.searchDomains = tunnelConfiguration.interface.dnsSearch
|
||||
dnsSettings.matchDomains = [""] // All DNS queries must first go through the tunnel's DNS
|
||||
networkSettings.dnsSettings = dnsSettings
|
||||
|
||||
|
||||
Reference in New Issue
Block a user