Skip to content

Commit

Permalink
REALITY, TLS config: Set "chrome" as the default fingerprint
Browse files Browse the repository at this point in the history
Other VLESS implementations should follow this change.
  • Loading branch information
RPRX authored Dec 17, 2024
1 parent 5836afc commit 96fb680
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
14 changes: 6 additions & 8 deletions infra/conf/transport_internet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"`)
config.Fingerprint = strings.ToLower(c.Fingerprint)
if config.Fingerprint == "unsafe" || config.Fingerprint == "hellogolang" {
return nil, errors.New(`invalid "fingerprint": `, config.Fingerprint)
}
if config.Fingerprint = strings.ToLower(c.Fingerprint); tls.GetFingerprint(config.Fingerprint) == nil {
if tls.GetFingerprint(config.Fingerprint) == nil {
return nil, errors.New(`unknown "fingerprint": `, config.Fingerprint)
}
if config.Fingerprint == "hellogolang" {
return nil, errors.New(`invalid "fingerprint": `, config.Fingerprint)
}
if len(c.ServerNames) != 0 {
return nil, errors.New(`non-empty "serverNames", please use "serverName" instead`)
}
Expand Down
3 changes: 2 additions & 1 deletion transport/internet/tls/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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{
Expand Down

3 comments on commit 96fb680

@alphax-hue3682
Copy link

@alphax-hue3682 alphax-hue3682 commented on 96fb680 Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for answering And the last question, is Chrome fingerprints recommended only for reality or all protocols?!
@RPRX

@RPRX
Copy link
Member Author

@RPRX RPRX commented on 96fb680 Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alphax-hue3682 Chrome 市占率近乎垄断,所以对于所有协议,指纹选它是最合理的,不推荐 random / randomized / unsafe (golang)

@NSCAP-BOT
Copy link

@NSCAP-BOT NSCAP-BOT commented on 96fb680 Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

疑似存在选什么指纹都能跟服务端建立连线的情况(reality),我服务端utls选chrome,客户端选qq都行。需要更多测试 @RPRX

Please sign in to comment.