Refine must2 and apply NewAesGcm() to all usage (#5011)

* Refine must2 and apply NewAesGcm() to all usage

* Remove unused package

* Fix test
This commit is contained in:
风扇滑翔翼
2025-08-11 09:37:46 +08:00
committed by GitHub
parent 0cceea75da
commit b1107b9810
12 changed files with 37 additions and 96 deletions

View File

@@ -3,8 +3,6 @@ package reality
import (
"bytes"
"context"
"crypto/aes"
"crypto/cipher"
"crypto/ecdh"
"crypto/ed25519"
"crypto/hmac"
@@ -169,8 +167,7 @@ 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
}
block, _ := aes.NewCipher(uConn.AuthKey)
aead, _ := cipher.NewGCM(block)
aead := crypto.NewAesGcm(uConn.AuthKey)
if config.Show {
fmt.Printf("REALITY localAddr: %v\tuConn.AuthKey[:16]: %v\tAEAD: %T\n", localAddr, uConn.AuthKey[:16], aead)
}