feat(dns): add support for DNS-over-HTTPS and update version

This commit is contained in:
2026-06-06 11:12:05 +08:00
parent 26f3af3fdd
commit a2b9062f2c
6 changed files with 198 additions and 4 deletions

View File

@@ -17,9 +17,15 @@ package net
import (
"context"
"net"
"strings"
)
func SetDefaultDNSAddress(dnsAddress string) {
// DNS-over-HTTPS endpoint, e.g. https://1.1.1.1/dns-query
if strings.HasPrefix(dnsAddress, "https://") {
SetDefaultDNSOverHTTPS(dnsAddress)
return
}
if _, _, err := net.SplitHostPort(dnsAddress); err != nil {
dnsAddress = net.JoinHostPort(dnsAddress, "53")
}