Skip to content

Commit 40bd06a

Browse files
committed
Only allow ip address to be used to set doh
1 parent bcc213b commit 40bd06a

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

daze.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"math/rand/v2"
2121
"net"
2222
"net/http"
23-
"net/url"
2423
"os"
2524
"path/filepath"
2625
"strconv"
@@ -151,19 +150,12 @@ func (c *WireConn) Write(b []byte) (n int, err error) {
151150

152151
// ResolverDoh returns a DoH resolver. For further information, see https://datatracker.ietf.org/doc/html/rfc8484.
153152
func ResolverDoh(addr string) *net.Resolver {
154-
urls := doa.Try(url.Parse(addr))
155-
host := doa.Try(net.LookupHost(urls.Hostname()))[0]
156-
port := urls.Port()
157-
urls.Host = host
158-
if port != "" {
159-
urls.Host = host + ":" + port
160-
}
161153
return &net.Resolver{
162154
PreferGo: true,
163155
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
164156
conn := &WireConn{
165157
Call: func(b []byte) ([]byte, error) {
166-
resp, err := http.Post(urls.String(), "application/dns-message", bytes.NewReader(b))
158+
resp, err := http.Post(addr, "application/dns-message", bytes.NewReader(b))
167159
if err != nil {
168160
return nil, err
169161
}

0 commit comments

Comments
 (0)