mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-04 04:47:30 +00:00
fix: reality shouldn't check chacha
This commit is contained in:
@@ -24,7 +24,6 @@ import (
|
||||
|
||||
"github.com/metacubex/randv2"
|
||||
utls "github.com/metacubex/utls"
|
||||
"golang.org/x/crypto/chacha20poly1305"
|
||||
"golang.org/x/crypto/hkdf"
|
||||
"golang.org/x/net/http2"
|
||||
)
|
||||
@@ -107,13 +106,8 @@ func GetRealityConn(ctx context.Context, conn net.Conn, fingerprint UClientHello
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var aeadCipher cipher.AEAD
|
||||
if utls.AesgcmPreferred(hello.CipherSuites) {
|
||||
aesBlock, _ := aes.NewCipher(authKey)
|
||||
aeadCipher, _ = cipher.NewGCM(aesBlock)
|
||||
} else {
|
||||
aeadCipher, _ = chacha20poly1305.New(authKey)
|
||||
}
|
||||
aesBlock, _ := aes.NewCipher(authKey)
|
||||
aeadCipher, _ := cipher.NewGCM(aesBlock)
|
||||
aeadCipher.Seal(hello.SessionId[:0], hello.Random[20:], hello.SessionId[:16], hello.Raw)
|
||||
copy(hello.Raw[39:], hello.SessionId)
|
||||
//log.Debugln("REALITY hello.sessionId: %v", hello.SessionId)
|
||||
|
||||
Reference in New Issue
Block a user