mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-27 09:17:12 +00:00
chore: update uTLS to 1.5.4
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user