Refine randomized

But we should avoid using it unless we have to, see
https://github.com/refraction-networking/utls/pull/157#issuecomment-1417156797
This commit is contained in:
RPRX 2023-02-08 14:51:15 +08:00 committed by GitHub
parent c3faa8b7ac
commit f32921df30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 11 deletions

View file

@ -12,6 +12,13 @@ import (
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
type Interface interface {
net.Conn
Handshake() error
VerifyHostname(host string) error
NegotiatedProtocol() (name string, mutual bool)
}
var _ buf.Writer = (*Conn)(nil)
type Conn struct {
@ -125,6 +132,13 @@ func init() {
}
i++
}
weights := utls.DefaultWeights
weights.TLSVersMax_Set_VersionTLS13 = 1
weights.FirstKeyShare_Set_CurveP256 = 0
randomized := utls.HelloRandomized
randomized.Seed, _ = utls.NewPRNGSeed()
randomized.Weights = &weights
PresetFingerprints["randomized"] = &randomized
}
func GetFingerprint(name string) (fingerprint *utls.ClientHelloID) {
@ -154,7 +168,7 @@ var PresetFingerprints = map[string]*utls.ClientHelloID{
"360": &utls.Hello360_Auto,
"qq": &utls.HelloQQ_Auto,
"random": nil,
"randomized": &utls.HelloRandomized,
"randomized": nil,
}
var ModernFingerprints = map[string]*utls.ClientHelloID{
@ -203,10 +217,3 @@ var OtherFingerprints = map[string]*utls.ClientHelloID{
"helloios_11_1": &utls.HelloIOS_11_1,
"hello360_7_5": &utls.Hello360_7_5,
}
type Interface interface {
net.Conn
Handshake() error
VerifyHostname(host string) error
NegotiatedProtocol() (name string, mutual bool)
}