diff --git a/component/dialer/dialer.go b/component/dialer/dialer.go index ab2fe047..1925e86c 100644 --- a/component/dialer/dialer.go +++ b/component/dialer/dialer.go @@ -136,10 +136,11 @@ func serialDualStackDialContext(ctx context.Context, network, address string, op if opt.prefer != 4 && opt.prefer != 6 { return serialDialContext(ctx, network, ips, port, opt) } + ipv4s, ipv6s := sortationAddr(ips) return dualStackDialContext( ctx, - func(ctx context.Context) (net.Conn, error) { return serialDialContext(ctx, network, ips, port, opt) }, - func(ctx context.Context) (net.Conn, error) { return serialDialContext(ctx, network, ips, port, opt) }, + func(ctx context.Context) (net.Conn, error) { return serialDialContext(ctx, network, ipv4s, port, opt) }, + func(ctx context.Context) (net.Conn, error) { return serialDialContext(ctx, network, ipv6s, port, opt) }, opt.prefer == 4) }