Feature: sync missing resolver logic from premium, but still net.IP on opensource
This commit is contained in:
@ -4,7 +4,9 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
@ -91,10 +93,13 @@ func newDoHClient(url, iface string, r *Resolver) *dohClient {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ip, err := resolver.ResolveIPWithResolver(host, r)
|
||||
ips, err := resolver.LookupIPWithResolver(ctx, host, r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if len(ips) == 0 {
|
||||
return nil, fmt.Errorf("%w: %s", resolver.ErrIPNotFound, host)
|
||||
}
|
||||
ip := ips[rand.Intn(len(ips))]
|
||||
|
||||
options := []dialer.Option{}
|
||||
if iface != "" {
|
||||
|
Reference in New Issue
Block a user