0
mirror of https://github.com/XTLS/Xray-core.git synced 2025-06-19 06:39:48 +03:00

New feature: Happy Eyeballs (RFC 8305) (#4667)

Closes https://github.com/XTLS/Xray-core/issues/4473
This commit is contained in:
patterniha
2025-06-07 16:50:06 +03:30
committed by GitHub
parent bfbccc2721
commit 97fdcb4228
6 changed files with 417 additions and 99 deletions

View File

@ -26,6 +26,7 @@ func TestSocketConfig(t *testing.T) {
Tfo: 256,
DomainStrategy: internet.DomainStrategy_USE_IP,
DialerProxy: "tag",
HappyEyeballs: &internet.HappyEyeballsConfig{Interleave: 1, TryDelayMs: 0, PrioritizeIpv6: false, MaxConcurrentTry: 4},
}
runMultiTestCase(t, []TestCase{
{
@ -45,8 +46,9 @@ func TestSocketConfig(t *testing.T) {
// test "tcpFastOpen": false, disabled TFO is expected
expectedOutput = &internet.SocketConfig{
Mark: 0,
Tfo: -1,
Mark: 0,
Tfo: -1,
HappyEyeballs: &internet.HappyEyeballsConfig{Interleave: 1, TryDelayMs: 0, PrioritizeIpv6: false, MaxConcurrentTry: 4},
}
runMultiTestCase(t, []TestCase{
{
@ -63,8 +65,9 @@ func TestSocketConfig(t *testing.T) {
// test "tcpFastOpen": 65535, queue length 65535 is expected
expectedOutput = &internet.SocketConfig{
Mark: 0,
Tfo: 65535,
Mark: 0,
Tfo: 65535,
HappyEyeballs: &internet.HappyEyeballsConfig{Interleave: 1, TryDelayMs: 0, PrioritizeIpv6: false, MaxConcurrentTry: 4},
}
runMultiTestCase(t, []TestCase{
{
@ -81,8 +84,9 @@ func TestSocketConfig(t *testing.T) {
// test "tcpFastOpen": -65535, disable TFO is expected
expectedOutput = &internet.SocketConfig{
Mark: 0,
Tfo: -65535,
Mark: 0,
Tfo: -65535,
HappyEyeballs: &internet.HappyEyeballsConfig{Interleave: 1, TryDelayMs: 0, PrioritizeIpv6: false, MaxConcurrentTry: 4},
}
runMultiTestCase(t, []TestCase{
{
@ -99,8 +103,9 @@ func TestSocketConfig(t *testing.T) {
// test "tcpFastOpen": 0, no operation is expected
expectedOutput = &internet.SocketConfig{
Mark: 0,
Tfo: 0,
Mark: 0,
Tfo: 0,
HappyEyeballs: &internet.HappyEyeballsConfig{Interleave: 1, TryDelayMs: 0, PrioritizeIpv6: false, MaxConcurrentTry: 4},
}
runMultiTestCase(t, []TestCase{
{
@ -117,8 +122,9 @@ func TestSocketConfig(t *testing.T) {
// test omit "tcpFastOpen", no operation is expected
expectedOutput = &internet.SocketConfig{
Mark: 0,
Tfo: 0,
Mark: 0,
Tfo: 0,
HappyEyeballs: &internet.HappyEyeballsConfig{Interleave: 1, TryDelayMs: 0, PrioritizeIpv6: false, MaxConcurrentTry: 4},
}
runMultiTestCase(t, []TestCase{
{
@ -133,8 +139,9 @@ func TestSocketConfig(t *testing.T) {
// test "tcpFastOpen": null, no operation is expected
expectedOutput = &internet.SocketConfig{
Mark: 0,
Tfo: 0,
Mark: 0,
Tfo: 0,
HappyEyeballs: &internet.HappyEyeballsConfig{Interleave: 1, TryDelayMs: 0, PrioritizeIpv6: false, MaxConcurrentTry: 4},
}
runMultiTestCase(t, []TestCase{
{