chore(dns): merge DoT settings with DNS settings

This commit is contained in:
Quentin McGaw
2025-11-05 20:14:25 +00:00
parent 96d8b53338
commit 7dbd14df27
11 changed files with 155 additions and 222 deletions

View File

@@ -1,7 +1,6 @@
package dns
import (
"net/netip"
"time"
"github.com/qdm12/dns/v2/pkg/nameserver"
@@ -10,15 +9,7 @@ import (
func (l *Loop) useUnencryptedDNS(fallback bool) {
settings := l.GetSettings()
// Try with user provided plaintext ip address
// if it's not 127.0.0.1 (default for DoT), otherwise
// use the first DoT provider ipv4 address found.
var targetIP netip.Addr
if settings.ServerAddress.Compare(netip.AddrFrom4([4]byte{127, 0, 0, 1})) != 0 {
targetIP = settings.ServerAddress
} else {
targetIP = settings.DoT.GetFirstPlaintextIPv4()
}
targetIP := settings.GetFirstPlaintextIPv4()
if fallback {
l.logger.Info("falling back on plaintext DNS at address " + targetIP.String())