diff --git a/go.mod b/go.mod index 42174255..83a499a5 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/stretchr/testify v1.10.0 github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e github.com/vishvananda/netlink v1.3.1 - github.com/xtls/reality v0.0.0-20250513125209-514f8647eac0 + github.com/xtls/reality v0.0.0-20250516070713-4df2ec9a5b47 go4.org/netipx v0.0.0-20231129151722-fdeea329fbba golang.org/x/crypto v0.38.0 golang.org/x/net v0.40.0 diff --git a/go.sum b/go.sum index 15a0f757..e99d46a8 100644 --- a/go.sum +++ b/go.sum @@ -76,10 +76,8 @@ github.com/vishvananda/netlink v1.3.1 h1:3AEMt62VKqz90r0tmNhog0r/PpWKmrEShJU0wJW github.com/vishvananda/netlink v1.3.1/go.mod h1:ARtKouGSTGchR8aMwmkzC0qiNPrrWO5JS/XMVl45+b4= github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY= github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM= -github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d h1:+B97uD9uHLgAAulhigmys4BVwZZypzK7gPN3WtpgRJg= -github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d/go.mod h1:dm4y/1QwzjGaK17ofi0Vs6NpKAHegZky8qk6J2JJZAE= -github.com/xtls/reality v0.0.0-20250513125209-514f8647eac0 h1:ou6jXqJ9Ogs0BaEIzuszo1HMBokiKpf7XpNdsVYcvfA= -github.com/xtls/reality v0.0.0-20250513125209-514f8647eac0/go.mod h1:bJdU3ExzfUlY40Xxfibq3THW9IHiE8mHu/tEzud5JWM= +github.com/xtls/reality v0.0.0-20250516070713-4df2ec9a5b47 h1:9aJWkgWBwZ83l3j7+hBh3SurvRKuNfCgsSner5n6BcM= +github.com/xtls/reality v0.0.0-20250516070713-4df2ec9a5b47/go.mod h1:bJdU3ExzfUlY40Xxfibq3THW9IHiE8mHu/tEzud5JWM= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= diff --git a/transport/internet/reality/reality.go b/transport/internet/reality/reality.go index 0543b26d..ac017ed6 100644 --- a/transport/internet/reality/reality.go +++ b/transport/internet/reality/reality.go @@ -30,14 +30,10 @@ import ( "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/core" "github.com/xtls/xray-core/transport/internet/tls" - "golang.org/x/crypto/chacha20poly1305" "golang.org/x/crypto/hkdf" "golang.org/x/net/http2" ) -//go:linkname aesgcmPreferred github.com/refraction-networking/utls.aesgcmPreferred -func aesgcmPreferred(ciphers []uint16) bool - type Conn struct { *reality.Conn } @@ -147,13 +143,8 @@ func UClient(c net.Conn, config *Config, ctx context.Context, dest net.Destinati if _, err := hkdf.New(sha256.New, uConn.AuthKey, hello.Random[:20], []byte("REALITY")).Read(uConn.AuthKey); err != nil { return nil, err } - var aead cipher.AEAD - if aesgcmPreferred(hello.CipherSuites) { - block, _ := aes.NewCipher(uConn.AuthKey) - aead, _ = cipher.NewGCM(block) - } else { - aead, _ = chacha20poly1305.New(uConn.AuthKey) - } + block, _ := aes.NewCipher(uConn.AuthKey) + aead, _ := cipher.NewGCM(block) if config.Show { errors.LogInfo(ctx, fmt.Sprintf("REALITY localAddr: %v\tuConn.AuthKey[:16]: %v\tAEAD: %T\n", localAddr, uConn.AuthKey[:16], aead)) }