mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 10:44:02 +03:00
Propagate DNS setting to configuration
This commit is contained in:
@@ -21,6 +21,14 @@ func GetDNS(u *url.URL) (*net.Resolver, error) {
|
||||
return dns.NewCachingResolver(nil, dnsCacheOptions...), nil
|
||||
}
|
||||
|
||||
if u.Scheme == "" {
|
||||
u.Scheme = "udp"
|
||||
}
|
||||
if u.Scheme == "udp" && u.Host == "" {
|
||||
u.Host = u.Path
|
||||
u.Path = ""
|
||||
}
|
||||
|
||||
switch u.Scheme {
|
||||
case "tls":
|
||||
return dns.NewDoTResolver(u.Host, dns.DoTCache(dnsCacheOptions...))
|
||||
|
||||
Reference in New Issue
Block a user