Issue #3: Fixed DoH server URL. Moved settings creation to BlocklistOption.
This commit is contained in:
parent
6ca509f7fb
commit
807176f0b5
2 changed files with 10 additions and 17 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import NetworkExtension
|
||||||
|
|
||||||
enum BlocklistOption: String, CaseIterable, Identifiable {
|
enum BlocklistOption: String, CaseIterable, Identifiable {
|
||||||
case secure = "Secure"
|
case secure = "Secure"
|
||||||
|
|
@ -66,4 +67,12 @@ enum BlocklistOption: String, CaseIterable, Identifiable {
|
||||||
return "2001:db8::1"
|
return "2001:db8::1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var settings: NEDNSOverHTTPSSettings {
|
||||||
|
let settings = NEDNSOverHTTPSSettings(servers: [ipv4, ipv6])
|
||||||
|
settings.serverURL = URL(string: "https://\(server)/dns-query")
|
||||||
|
settings.matchDomains = [""]
|
||||||
|
|
||||||
|
return settings
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,23 +41,7 @@ class ViewModel: NSObject, ObservableObject {
|
||||||
func toggleDns() {
|
func toggleDns() {
|
||||||
Task {
|
Task {
|
||||||
if isDnsEnabled {
|
if isDnsEnabled {
|
||||||
do {
|
manager.dnsSettings = blocklist.settings
|
||||||
try await manager.loadFromPreferences()
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
log.error("Error loading preferences: \(error)")
|
|
||||||
|
|
||||||
delayedToggle(false)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let settings = NEDNSOverHTTPSSettings(servers: [blocklist.ipv4, blocklist.ipv6])
|
|
||||||
settings.serverURL = URL(string: "https://\(blocklist.server)")
|
|
||||||
settings.matchDomains = [""]
|
|
||||||
|
|
||||||
|
|
||||||
manager.dnsSettings = settings
|
|
||||||
manager.localizedDescription = blocklist.description
|
manager.localizedDescription = blocklist.description
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue