mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-03 01:48:40 +00:00
Merge commit '800b8b50cc
' into ECH
This commit is contained in:
commit
cd3fabe9bd
10 changed files with 54 additions and 72 deletions
|
@ -30,14 +30,10 @@ import (
|
|||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/core"
|
||||
"github.com/xtls/xray-core/transport/internet/tls"
|
||||
"golang.org/x/crypto/chacha20poly1305"
|
||||
"golang.org/x/crypto/hkdf"
|
||||
"golang.org/x/net/http2"
|
||||
)
|
||||
|
||||
//go:linkname aesgcmPreferred github.com/refraction-networking/utls.aesgcmPreferred
|
||||
func aesgcmPreferred(ciphers []uint16) bool
|
||||
|
||||
type Conn struct {
|
||||
*reality.Conn
|
||||
}
|
||||
|
@ -147,13 +143,8 @@ 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
|
||||
}
|
||||
var aead cipher.AEAD
|
||||
if aesgcmPreferred(hello.CipherSuites) {
|
||||
block, _ := aes.NewCipher(uConn.AuthKey)
|
||||
aead, _ = cipher.NewGCM(block)
|
||||
} else {
|
||||
aead, _ = chacha20poly1305.New(uConn.AuthKey)
|
||||
}
|
||||
block, _ := aes.NewCipher(uConn.AuthKey)
|
||||
aead, _ := cipher.NewGCM(block)
|
||||
if config.Show {
|
||||
errors.LogInfo(ctx, fmt.Sprintf("REALITY localAddr: %v\tuConn.AuthKey[:16]: %v\tAEAD: %T\n", localAddr, uConn.AuthKey[:16], aead))
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ func init() {
|
|||
|
||||
func GetFingerprint(name string) (fingerprint *utls.ClientHelloID) {
|
||||
if name == "" {
|
||||
return &utls.HelloChrome_120
|
||||
return &utls.HelloChrome_Auto
|
||||
}
|
||||
if fingerprint = PresetFingerprints[name]; fingerprint != nil {
|
||||
return
|
||||
|
@ -180,7 +180,7 @@ func GetFingerprint(name string) (fingerprint *utls.ClientHelloID) {
|
|||
|
||||
var PresetFingerprints = map[string]*utls.ClientHelloID{
|
||||
// Recommended preset options in GUI clients
|
||||
"chrome": &utls.HelloChrome_120,
|
||||
"chrome": &utls.HelloChrome_Auto,
|
||||
"firefox": &utls.HelloFirefox_Auto,
|
||||
"safari": &utls.HelloSafari_Auto,
|
||||
"ios": &utls.HelloIOS_Auto,
|
||||
|
@ -207,6 +207,7 @@ var ModernFingerprints = map[string]*utls.ClientHelloID{
|
|||
"hellochrome_102": &utls.HelloChrome_102,
|
||||
"hellochrome_106_shuffle": &utls.HelloChrome_106_Shuffle,
|
||||
"hellochrome_120": &utls.HelloChrome_120,
|
||||
"hellochrome_131": &utls.HelloChrome_131,
|
||||
"helloios_13": &utls.HelloIOS_13,
|
||||
"helloios_14": &utls.HelloIOS_14,
|
||||
"helloedge_85": &utls.HelloEdge_85,
|
||||
|
@ -242,12 +243,11 @@ var OtherFingerprints = map[string]*utls.ClientHelloID{
|
|||
"hello360_7_5": &utls.Hello360_7_5,
|
||||
"helloqq_auto": &utls.HelloQQ_Auto,
|
||||
|
||||
// reality currently does not support these new fingerprints
|
||||
// Chrome betas'
|
||||
"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,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue