Skip to content

Commit 9cc208b

Browse files
committed
fix: reality shouldn't check chacha
1 parent b57f305 commit 9cc208b

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

component/tls/reality.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424

2525
"github.com/metacubex/randv2"
2626
utls "github.com/metacubex/utls"
27-
"golang.org/x/crypto/chacha20poly1305"
2827
"golang.org/x/crypto/hkdf"
2928
"golang.org/x/net/http2"
3029
)
@@ -107,13 +106,8 @@ func GetRealityConn(ctx context.Context, conn net.Conn, fingerprint UClientHello
107106
if err != nil {
108107
return nil, err
109108
}
110-
var aeadCipher cipher.AEAD
111-
if utls.AesgcmPreferred(hello.CipherSuites) {
112-
aesBlock, _ := aes.NewCipher(authKey)
113-
aeadCipher, _ = cipher.NewGCM(aesBlock)
114-
} else {
115-
aeadCipher, _ = chacha20poly1305.New(authKey)
116-
}
109+
aesBlock, _ := aes.NewCipher(authKey)
110+
aeadCipher, _ := cipher.NewGCM(aesBlock)
117111
aeadCipher.Seal(hello.SessionId[:0], hello.Random[20:], hello.SessionId[:16], hello.Raw)
118112
copy(hello.Raw[39:], hello.SessionId)
119113
//log.Debugln("REALITY hello.sessionId: %v", hello.SessionId)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ require (
3737
github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f
3838
github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719
3939
github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0
40-
github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2
40+
github.com/metacubex/utls v1.8.1-0.20250923095929-5a5baffa4b76
4141
github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f
4242
github.com/miekg/dns v1.1.63 // lastest version compatible with golang1.20
4343
github.com/mroth/weightedrand/v2 v2.1.0

go.sum

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719 h1:T6qCCfolRDAVJKea
145145
github.com/metacubex/smux v0.0.0-20250922175018-15c9a6a78719/go.mod h1:4bPD8HWx9jPJ9aE4uadgyN7D1/Wz3KmPy+vale8sKLE=
146146
github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0 h1:Ui+/2s5Qz0lSnDUBmEL12M5Oi/PzvFxGTNohm8ZcsmE=
147147
github.com/metacubex/tfo-go v0.0.0-20250921095601-b102db4216c0/go.mod h1:l9oLnLoEXyGZ5RVLsh7QCC5XsouTUyKk4F2nLm2DHLw=
148-
github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2 h1:5OGzQvoE5yuOe8AsZsFwhf32ZxKmKN9G+k06AVd+6jY=
149-
github.com/metacubex/utls v1.8.1-0.20250921102910-221428e5d4b2/go.mod h1:GN/CB3TRwQ9LYquYpIFynDkvMTYmkjwI7+mkUIoHj88=
148+
github.com/metacubex/utls v1.8.1-0.20250923095929-5a5baffa4b76 h1:AVnkXS1hC68RIuMYDg3URfmf/GdOeNIfj0RUwRj9G+Q=
149+
github.com/metacubex/utls v1.8.1-0.20250923095929-5a5baffa4b76/go.mod h1:67I3skhEY4Sya8f1YxELwWPoeQdXqZCrWNYLvq8gn2U=
150150
github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f h1:FGBPRb1zUabhPhDrlKEjQ9lgIwQ6cHL4x8M9lrERhbk=
151151
github.com/metacubex/wireguard-go v0.0.0-20250820062549-a6cecdd7f57f/go.mod h1:oPGcV994OGJedmmxrcK9+ni7jUEMGhR+uVQAdaduIP4=
152152
github.com/metacubex/yamux v0.0.0-20250918083631-dd5f17c0be49 h1:lhlqpYHopuTLx9xQt22kSA9HtnyTDmk5XjjQVCGHe2E=
@@ -206,7 +206,6 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
206206
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
207207
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
208208
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
209-
github.com/tiendc/go-deepcopy v1.6.1 h1:uVRTItFeNHkMcLueHS7OCsxgxT9P8MzGB/taUa2Y4Tk=
210209
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
211210
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
212211
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=

0 commit comments

Comments
 (0)