chore: update uTLS to 1.5.4

This commit is contained in:
wwqgtxx
2023-12-09 12:28:19 +08:00
parent 9729c2e440
commit 5a2ed71bd9
4 changed files with 42 additions and 26 deletions

View File

@@ -5,6 +5,7 @@ import (
"context"
"crypto/aes"
"crypto/cipher"
"crypto/ecdh"
"crypto/ed25519"
"crypto/hmac"
"crypto/sha256"
@@ -81,15 +82,22 @@ func GetRealityConn(ctx context.Context, conn net.Conn, ClientFingerprint string
//log.Debugln("REALITY hello.sessionId[:16]: %v", hello.SessionId[:16])
ecdheParams := uConn.HandshakeState.State13.EcdheParams
if ecdheParams == nil {
publicKey, err := ecdh.X25519().NewPublicKey(realityConfig.PublicKey[:])
if err != nil {
return nil, err
}
ecdheKey := uConn.HandshakeState.State13.EcdheKey
if ecdheKey == nil {
// WTF???
if retry > 2 {
return nil, errors.New("nil ecdheParams")
return nil, errors.New("nil ecdheKey")
}
continue // retry
}
authKey := ecdheParams.SharedKey(realityConfig.PublicKey[:])
authKey, err := ecdheKey.ECDH(publicKey)
if err != nil {
return nil, err
}
if authKey == nil {
return nil, errors.New("nil auth_key")
}

View File

@@ -68,16 +68,21 @@ func RollFingerprint() (UClientHelloID, bool) {
}
var Fingerprints = map[string]UClientHelloID{
"chrome": {&utls.HelloChrome_Auto},
"firefox": {&utls.HelloFirefox_Auto},
"safari": {&utls.HelloSafari_Auto},
"ios": {&utls.HelloIOS_Auto},
"android": {&utls.HelloAndroid_11_OkHttp},
"edge": {&utls.HelloEdge_Auto},
"360": {&utls.Hello360_Auto},
"qq": {&utls.HelloQQ_Auto},
"random": {nil},
"randomized": {nil},
"chrome": {&utls.HelloChrome_Auto},
"chrome_psk": {&utls.HelloChrome_100_PSK},
"chrome_psk_shuffle": {&utls.HelloChrome_106_Shuffle},
"chrome_padding_psk_shuffle": {&utls.HelloChrome_114_Padding_PSK_Shuf},
"chrome_pq": {&utls.HelloChrome_115_PQ},
"chrome_pq_psk": {&utls.HelloChrome_115_PQ_PSK},
"firefox": {&utls.HelloFirefox_Auto},
"safari": {&utls.HelloSafari_Auto},
"ios": {&utls.HelloIOS_Auto},
"android": {&utls.HelloAndroid_11_OkHttp},
"edge": {&utls.HelloEdge_Auto},
"360": {&utls.Hello360_Auto},
"qq": {&utls.HelloQQ_Auto},
"random": {nil},
"randomized": {nil},
}
func init() {