mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-17 17:48:40 +00:00
New feature: Happy Eyeballs (RFC 8305)
This commit is contained in:
parent
aa4134f4a6
commit
4be238a5f3
6 changed files with 413 additions and 99 deletions
|
@ -255,9 +255,11 @@ func DialSystem(ctx context.Context, dest net.Destination, sockopt *SocketConfig
|
|||
if sockopt.DomainStrategy.forceIP() {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
} else if !sockopt.HappyEyeballs.Enabled || len(ips) < 2 || len(sockopt.DialerProxy) > 0 || dest.Network != net.Network_TCP {
|
||||
dest.Address = net.IPAddress(ips[dice.Roll(len(ips))])
|
||||
errors.LogInfo(ctx, "replace destination with "+dest.String())
|
||||
} else {
|
||||
return TcpRaceDial(ctx, src, ips, dest.Port, sockopt)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue