netutil: don't resolve unix socket URLs when comparing URLs
Was causing VerifyBootstrap() to hang on unix peers.
@@ -92,7 +92,10 @@ func resolveTCPAddrs(ctx context.Context, urls [][]url.URL) ([][]url.URL, error)
}
func resolveURL(ctx context.Context, u url.URL) (string, error) {
- for ctx.Err() == nil {
+ if u.Scheme == "unix" || u.Scheme == "unixs" {
+ // unix sockets don't resolve over TCP
+ return "", nil
+ }
host, _, err := net.SplitHostPort(u.Host)
if err != nil {
plog.Errorf("could not parse url %s during tcp resolving", u.Host)
@@ -101,6 +104,7 @@ func resolveURL(ctx context.Context, u url.URL) (string, error) {
if host == "localhost" || net.ParseIP(host) != nil {
return "", nil
}
+ for ctx.Err() == nil {
tcpAddr, err := resolveTCPAddr(ctx, u.Host)
if err == nil {
plog.Infof("resolving %s to %s", u.Host, tcpAddr.String())
