fix: parsing ipv6 doh error
This commit is contained in:
parent
22d25db573
commit
00f554fad3
1 changed files with 18 additions and 23 deletions
|
@ -890,29 +890,24 @@ func parseNameServer(servers []string, preferH3 bool) ([]dns.NameServer, error)
|
||||||
addr, err = hostWithDefaultPort(u.Host, "853")
|
addr, err = hostWithDefaultPort(u.Host, "853")
|
||||||
dnsNetType = "tcp-tls" // DNS over TLS
|
dnsNetType = "tcp-tls" // DNS over TLS
|
||||||
case "https":
|
case "https":
|
||||||
host := u.Host
|
addr, err = hostWithDefaultPort(u.Host, "443")
|
||||||
proxyAdapter = ""
|
if err == nil {
|
||||||
if _, _, err := net.SplitHostPort(host); err != nil && strings.Contains(err.Error(), "missing port in address") {
|
proxyAdapter = ""
|
||||||
host = net.JoinHostPort(host, "443")
|
clearURL := url.URL{Scheme: "https", Host: addr, Path: u.Path}
|
||||||
} else {
|
addr = clearURL.String()
|
||||||
if err != nil {
|
dnsNetType = "https" // DNS over HTTPS
|
||||||
return nil, err
|
if len(u.Fragment) != 0 {
|
||||||
}
|
for _, s := range strings.Split(u.Fragment, "&") {
|
||||||
}
|
arr := strings.Split(s, "=")
|
||||||
clearURL := url.URL{Scheme: "https", Host: host, Path: u.Path}
|
if len(arr) == 0 {
|
||||||
addr = clearURL.String()
|
continue
|
||||||
dnsNetType = "https" // DNS over HTTPS
|
} else if len(arr) == 1 {
|
||||||
if len(u.Fragment) != 0 {
|
proxyAdapter = arr[0]
|
||||||
for _, s := range strings.Split(u.Fragment, "&") {
|
} else if len(arr) == 2 {
|
||||||
arr := strings.Split(s, "=")
|
params[arr[0]] = arr[1]
|
||||||
if len(arr) == 0 {
|
} else {
|
||||||
continue
|
params[arr[0]] = strings.Join(arr[1:], "=")
|
||||||
} else if len(arr) == 1 {
|
}
|
||||||
proxyAdapter = arr[0]
|
|
||||||
} else if len(arr) == 2 {
|
|
||||||
params[arr[0]] = arr[1]
|
|
||||||
} else {
|
|
||||||
params[arr[0]] = strings.Join(arr[1:], "=")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue