0
mirror of https://github.com/XTLS/Xray-core.git synced 2025-04-27 22:01:25 +03:00

uTLS: Add new fingerprints

PSK extension, Post-Quantum Key Agreement, ML-KEM
This commit is contained in:
yuhan6665 2025-04-26 12:00:27 -04:00
parent 0dd74cf072
commit a608c5a1db
2 changed files with 13 additions and 4 deletions

View File

@ -137,10 +137,10 @@ func UClient(c net.Conn, config *Config, ctx context.Context, dest net.Destinati
if err != nil { if err != nil {
return nil, errors.New("REALITY: publicKey == nil") return nil, errors.New("REALITY: publicKey == nil")
} }
if uConn.HandshakeState.State13.EcdheKey == nil { if uConn.HandshakeState.State13.KeyShareKeys.Ecdhe == nil {
return nil, errors.New("Current fingerprint ", uConn.ClientHelloID.Client, uConn.ClientHelloID.Version, " does not support TLS 1.3, REALITY handshake cannot establish.") return nil, errors.New("Current fingerprint ", uConn.ClientHelloID.Client, uConn.ClientHelloID.Version, " does not support TLS 1.3, REALITY handshake cannot establish.")
} }
uConn.AuthKey, _ = uConn.HandshakeState.State13.EcdheKey.ECDH(publicKey) uConn.AuthKey, _ = uConn.HandshakeState.State13.KeyShareKeys.Ecdhe.ECDH(publicKey)
if uConn.AuthKey == nil { if uConn.AuthKey == nil {
return nil, errors.New("REALITY: SharedKey == nil") return nil, errors.New("REALITY: SharedKey == nil")
} }

View File

@ -163,7 +163,7 @@ func init() {
func GetFingerprint(name string) (fingerprint *utls.ClientHelloID) { func GetFingerprint(name string) (fingerprint *utls.ClientHelloID) {
if name == "" { if name == "" {
return &utls.HelloChrome_Auto return &utls.HelloChrome_120
} }
if fingerprint = PresetFingerprints[name]; fingerprint != nil { if fingerprint = PresetFingerprints[name]; fingerprint != nil {
return return
@ -179,7 +179,7 @@ func GetFingerprint(name string) (fingerprint *utls.ClientHelloID) {
var PresetFingerprints = map[string]*utls.ClientHelloID{ var PresetFingerprints = map[string]*utls.ClientHelloID{
// Recommended preset options in GUI clients // Recommended preset options in GUI clients
"chrome": &utls.HelloChrome_Auto, "chrome": &utls.HelloChrome_120,
"firefox": &utls.HelloFirefox_Auto, "firefox": &utls.HelloFirefox_Auto,
"safari": &utls.HelloSafari_Auto, "safari": &utls.HelloSafari_Auto,
"ios": &utls.HelloIOS_Auto, "ios": &utls.HelloIOS_Auto,
@ -240,4 +240,13 @@ var OtherFingerprints = map[string]*utls.ClientHelloID{
"hello360_auto": &utls.Hello360_Auto, "hello360_auto": &utls.Hello360_Auto,
"hello360_7_5": &utls.Hello360_7_5, "hello360_7_5": &utls.Hello360_7_5,
"helloqq_auto": &utls.HelloQQ_Auto, "helloqq_auto": &utls.HelloQQ_Auto,
// reality currently does not support these new fingerprints
"hellochrome_100_psk": &utls.HelloChrome_100_PSK,
"hellochrome_112_psk_shuf": &utls.HelloChrome_112_PSK_Shuf,
"hellochrome_114_padding_psk_shuf": &utls.HelloChrome_114_Padding_PSK_Shuf,
"hellochrome_115_pq": &utls.HelloChrome_115_PQ,
"hellochrome_115_pq_psk": &utls.HelloChrome_115_PQ_PSK,
"hellochrome_120_pq": &utls.HelloChrome_120_PQ,
"hellochrome_131": &utls.HelloChrome_131,
} }