From 96fb680d45c6b356cadf67bcabe29ad5e1a2f6a5 Mon Sep 17 00:00:00 2001 From: RPRX <63339210+RPRX@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:02:51 +0000 Subject: [PATCH] REALITY, TLS config: Set "chrome" as the default fingerprint Other VLESS implementations should follow this change. --- infra/conf/transport_internet.go | 16 +++++++--------- transport/internet/tls/tls.go | 3 ++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/infra/conf/transport_internet.go b/infra/conf/transport_internet.go index 1731695d..e19c145c 100644 --- a/infra/conf/transport_internet.go +++ b/infra/conf/transport_internet.go @@ -165,7 +165,7 @@ func (c *WebSocketConfig) Build() (proto.Message, error) { } // Priority (client): host > serverName > address for k, v := range c.Headers { - if strings.ToLower(k) == "host"{ + if strings.ToLower(k) == "host" { errors.PrintDeprecatedFeatureWarning(`"host" in "headers"`, `independent "host"`) if c.Host == "" { c.Host = v @@ -438,7 +438,7 @@ func (c *TLSConfig) Build() (proto.Message, error) { config.MaxVersion = c.MaxVersion config.CipherSuites = c.CipherSuites config.Fingerprint = strings.ToLower(c.Fingerprint) - if config.Fingerprint != "" && tls.GetFingerprint(config.Fingerprint) == nil { + if config.Fingerprint != "unsafe" && tls.GetFingerprint(config.Fingerprint) == nil { return nil, errors.New(`unknown fingerprint: `, config.Fingerprint) } config.RejectUnknownSni = c.RejectUnknownSNI @@ -584,15 +584,13 @@ func (c *REALITYConfig) Build() (proto.Message, error) { config.ServerNames = c.ServerNames config.MaxTimeDiff = c.MaxTimeDiff } else { - if c.Fingerprint == "" { - return nil, errors.New(`empty "fingerprint"`) - } - if config.Fingerprint = strings.ToLower(c.Fingerprint); tls.GetFingerprint(config.Fingerprint) == nil { - return nil, errors.New(`unknown "fingerprint": `, config.Fingerprint) - } - if config.Fingerprint == "hellogolang" { + config.Fingerprint = strings.ToLower(c.Fingerprint) + if config.Fingerprint == "unsafe" || config.Fingerprint == "hellogolang" { return nil, errors.New(`invalid "fingerprint": `, config.Fingerprint) } + if tls.GetFingerprint(config.Fingerprint) == nil { + return nil, errors.New(`unknown "fingerprint": `, config.Fingerprint) + } if len(c.ServerNames) != 0 { return nil, errors.New(`non-empty "serverNames", please use "serverName" instead`) } diff --git a/transport/internet/tls/tls.go b/transport/internet/tls/tls.go index 38b603c0..4b8fa486 100644 --- a/transport/internet/tls/tls.go +++ b/transport/internet/tls/tls.go @@ -165,7 +165,7 @@ func init() { func GetFingerprint(name string) (fingerprint *utls.ClientHelloID) { if name == "" { - return + return &utls.HelloChrome_Auto } if fingerprint = PresetFingerprints[name]; fingerprint != nil { return @@ -191,6 +191,7 @@ var PresetFingerprints = map[string]*utls.ClientHelloID{ "qq": &utls.HelloQQ_Auto, "random": nil, "randomized": nil, + "unsafe": nil, } var ModernFingerprints = map[string]*utls.ClientHelloID{