parent
c15350fab6
commit
7bebd0c8a0
|
@ -11,8 +11,6 @@ public struct InterfaceConfiguration {
|
||||||
public var mtu: UInt16?
|
public var mtu: UInt16?
|
||||||
public var dns = [DNSServer]()
|
public var dns = [DNSServer]()
|
||||||
public var dnsSearch = [String]()
|
public var dnsSearch = [String]()
|
||||||
public var dnsHTTPSURL: URL?
|
|
||||||
public var dnsTLSServerName: String?
|
|
||||||
|
|
||||||
public init(privateKey: PrivateKey) {
|
public init(privateKey: PrivateKey) {
|
||||||
self.privateKey = privateKey
|
self.privateKey = privateKey
|
||||||
|
@ -29,8 +27,6 @@ extension InterfaceConfiguration: Equatable {
|
||||||
lhs.listenPort == rhs.listenPort &&
|
lhs.listenPort == rhs.listenPort &&
|
||||||
lhs.mtu == rhs.mtu &&
|
lhs.mtu == rhs.mtu &&
|
||||||
lhs.dns == rhs.dns &&
|
lhs.dns == rhs.dns &&
|
||||||
lhs.dnsSearch == rhs.dnsSearch &&
|
lhs.dnsSearch == rhs.dnsSearch
|
||||||
lhs.dnsHTTPSURL == rhs.dnsHTTPSURL &&
|
|
||||||
lhs.dnsTLSServerName == rhs.dnsTLSServerName
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,25 +85,11 @@ class PacketTunnelSettingsGenerator {
|
||||||
|
|
||||||
if !tunnelConfiguration.interface.dnsSearch.isEmpty || !tunnelConfiguration.interface.dns.isEmpty {
|
if !tunnelConfiguration.interface.dnsSearch.isEmpty || !tunnelConfiguration.interface.dns.isEmpty {
|
||||||
let dnsServerStrings = tunnelConfiguration.interface.dns.map { $0.stringRepresentation }
|
let dnsServerStrings = tunnelConfiguration.interface.dns.map { $0.stringRepresentation }
|
||||||
|
let dnsSettings = NEDNSSettings(servers: dnsServerStrings)
|
||||||
let dnsSettings: NEDNSSettings
|
|
||||||
if let dnsHTTPSURL = tunnelConfiguration.interface.dnsHTTPSURL {
|
|
||||||
let dohSettings = NEDNSOverHTTPSSettings(servers: dnsServerStrings)
|
|
||||||
dohSettings.serverURL = dnsHTTPSURL
|
|
||||||
dnsSettings = dohSettings
|
|
||||||
} else if let dnsTLSServerName = tunnelConfiguration.interface.dnsTLSServerName {
|
|
||||||
let dotSettings = NEDNSOverTLSSettings(servers: dnsServerStrings)
|
|
||||||
dotSettings.serverName = dnsTLSServerName
|
|
||||||
dnsSettings = dotSettings
|
|
||||||
} else {
|
|
||||||
dnsSettings = NEDNSSettings(servers: dnsServerStrings)
|
|
||||||
}
|
|
||||||
|
|
||||||
dnsSettings.searchDomains = tunnelConfiguration.interface.dnsSearch
|
dnsSettings.searchDomains = tunnelConfiguration.interface.dnsSearch
|
||||||
if !tunnelConfiguration.interface.dns.isEmpty {
|
if !tunnelConfiguration.interface.dns.isEmpty {
|
||||||
dnsSettings.matchDomains = [""] // All DNS queries must first go through the tunnel's DNS
|
dnsSettings.matchDomains = [""] // All DNS queries must first go through the tunnel's DNS
|
||||||
}
|
}
|
||||||
|
|
||||||
networkSettings.dnsSettings = dnsSettings
|
networkSettings.dnsSettings = dnsSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue