refactor: only export LookupNetIP for resolver package

This commit is contained in:
Shengjing Zhu
2022-07-23 17:14:01 +08:00
parent 9298006bc7
commit 4dc0f8e861
4 changed files with 141 additions and 67 deletions

View File

@@ -51,7 +51,7 @@ func dialWithDNS(dial dialer, dns string) dialer {
}
}
ips, err := resolv.LookupHost(ctx, host)
ips, err := resolv.LookupNetIP(ctx, network, host)
if err != nil {
return nil, err
}
@@ -61,7 +61,7 @@ func dialWithDNS(dial dialer, dns string) dialer {
conn net.Conn
)
for _, ip := range ips {
addr := net.JoinHostPort(ip, port)
addr := net.JoinHostPort(ip.String(), port)
conn, lastErr = dial(ctx, network, addr)
if lastErr == nil {
return conn, nil