fix: handle no IP address
This commit is contained in:
parent
2e90c3a7e8
commit
b7371738c4
1 changed files with 8 additions and 1 deletions
|
@ -218,13 +218,17 @@ func dualStackDialContext(
|
||||||
return res.Conn, nil
|
return res.Conn, nil
|
||||||
}
|
}
|
||||||
fallback = res
|
fallback = res
|
||||||
|
} else {
|
||||||
|
err = res.error
|
||||||
}
|
}
|
||||||
err = res.error
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func parallelDialContext(ctx context.Context, network string, ips []netip.Addr, port string, opt *option) (net.Conn, error) {
|
func parallelDialContext(ctx context.Context, network string, ips []netip.Addr, port string, opt *option) (net.Conn, error) {
|
||||||
|
if len(ips) == 0 {
|
||||||
|
return nil, errors.New("no ip address")
|
||||||
|
}
|
||||||
results := make(chan dialResult)
|
results := make(chan dialResult)
|
||||||
returned := make(chan struct{})
|
returned := make(chan struct{})
|
||||||
defer close(returned)
|
defer close(returned)
|
||||||
|
@ -267,6 +271,9 @@ func parallelDialContext(ctx context.Context, network string, ips []netip.Addr,
|
||||||
}
|
}
|
||||||
|
|
||||||
func serialDialContext(ctx context.Context, network string, ips []netip.Addr, port string, opt *option) (net.Conn, error) {
|
func serialDialContext(ctx context.Context, network string, ips []netip.Addr, port string, opt *option) (net.Conn, error) {
|
||||||
|
if len(ips) == 0 {
|
||||||
|
return nil, errors.New("no ip address")
|
||||||
|
}
|
||||||
var (
|
var (
|
||||||
conn net.Conn
|
conn net.Conn
|
||||||
err error
|
err error
|
||||||
|
|
Loading…
Reference in a new issue