TLS ECH client: Use chrome-fingerprint and add padding; Add "h2c" and echSockopt; Fix some issues (#4949)

Completes https://github.com/XTLS/Xray-core/pull/3813
This commit is contained in:
patterniha
2025-08-02 17:47:55 +02:00
committed by RPRX
parent 146b14ab55
commit a02723e63f
7 changed files with 224 additions and 150 deletions

View File

@@ -1,6 +1,7 @@
package tls
import (
"fmt"
"io"
"net/http"
"strings"
@@ -40,7 +41,7 @@ func TestECHDial(t *testing.T) {
}
wg.Wait()
// check cache
echConfigCache, ok := GlobalECHConfigCache.Load("encryptedsni.com|udp://1.1.1.1")
echConfigCache, ok := GlobalECHConfigCache.Load("encryptedsni.com|udp://1.1.1.1" + "|" + fmt.Sprintf("%p", config.EchSocketSettings))
if !ok {
t.Error("ECH config cache not found")
@@ -74,7 +75,7 @@ func TestECHDialFail(t *testing.T) {
_, err = io.ReadAll(resp.Body)
common.Must(err)
// check cache
echConfigCache, ok := GlobalECHConfigCache.Load("cloudflare.com|udp://1.1.1.1")
echConfigCache, ok := GlobalECHConfigCache.Load("cloudflare.com|udp://1.1.1.1" + "|" + fmt.Sprintf("%p", config.EchSocketSettings))
if !ok {
t.Error("ECH config cache not found")
}