Feature: support DoH

This commit is contained in:
Dreamacro
2019-06-28 12:29:08 +08:00
parent 662038e40e
commit bc3fc0c840
8 changed files with 412 additions and 260 deletions

View File

@ -475,9 +475,14 @@ func parseNameServer(servers []string) ([]dns.NameServer, error) {
case "tls":
host, err = hostWithDefaultPort(u.Host, "853")
dnsNetType = "tcp-tls" // DNS over TLS
case "https":
clearURL := url.URL{Scheme: "https", Host: u.Host, Path: u.Path}
host = clearURL.String()
dnsNetType = "https" // DNS over HTTPS
default:
return nil, fmt.Errorf("DNS NameServer[%d] unsupport scheme: %s", idx, u.Scheme)
}
if err != nil {
return nil, fmt.Errorf("DNS NameServer[%d] format error: %s", idx, err.Error())
}