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