Override manual DNS servers when using DoH/DoT (#283)

This commit is contained in:
Davide De Rosa 2023-04-06 12:50:39 +02:00 committed by GitHub
parent aec7f8eefe
commit 67fc2a3cc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 8 deletions

View File

@ -94,8 +94,23 @@ extension WireGuard.ConfigurationBuilder {
break
case .manual:
let isDNSEnabled = settings.configurationType != .disabled
switch settings.configurationType {
case .plain:
break
case .https:
dnsHTTPSURL = settings.dnsHTTPSURL
case .tls:
dnsTLSServerName = settings.dnsTLSServerName
case .disabled:
break
}
if isDNSEnabled {
dnsServers = settings.dnsServers ?? []
var allDomains: [String] = []
if let domain = settings.dnsDomain {
@ -105,14 +120,7 @@ extension WireGuard.ConfigurationBuilder {
allDomains.append(contentsOf: searchDomains)
}
dnsSearchDomains = allDomains.filter { !$0.isEmpty }
case .https:
dnsHTTPSURL = settings.dnsHTTPSURL
case .tls:
dnsTLSServerName = settings.dnsTLSServerName
case .disabled:
} else {
dnsServers = []
dnsSearchDomains = []
}