Skip to content

Commit

Permalink
Refine randomized
Browse files Browse the repository at this point in the history
But we should avoid using it unless we have to, see
refraction-networking/utls#157 (comment)
  • Loading branch information
Autumn216 committed Feb 8, 2023
1 parent 4285502 commit ddfe173
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/pelletier/go-toml v1.9.5
github.com/pires/go-proxyproto v0.6.2
github.com/quic-go/quic-go v0.32.0
github.com/refraction-networking/utls v1.2.0
github.com/refraction-networking/utls v1.2.2-0.20230207151345-a75a4b484849
github.com/sagernet/sing v0.1.6
github.com/sagernet/sing-shadowsocks v0.1.1-0.20230202035033-e3123545f2f7
github.com/sagernet/wireguard-go v0.0.0-20221116151939-c99467f53f2c
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ github.com/quic-go/qtls-go1-20 v0.1.0 h1:d1PK3ErFy9t7zxKsG3NXBJXZjp/kMLoIb3y/kV5
github.com/quic-go/qtls-go1-20 v0.1.0/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM=
github.com/quic-go/quic-go v0.32.0 h1:lY02md31s1JgPiiyfqJijpu/UX/Iun304FI3yUqX7tA=
github.com/quic-go/quic-go v0.32.0/go.mod h1:/fCsKANhQIeD5l76c2JFU+07gVE3KaA0FP+0zMWwfwo=
github.com/refraction-networking/utls v1.2.0 h1:U5f8wkij2NVinfLuJdFP3gCMwIHs+EzvhxmYdXgiapo=
github.com/refraction-networking/utls v1.2.0/go.mod h1:NPq+cVqzH7D1BeOkmOcb5O/8iVewAsiVt2x1/eO0hgQ=
github.com/refraction-networking/utls v1.2.2-0.20230207151345-a75a4b484849 h1:vNEcNapWFwnYJTBcVkHJa8VrdL40PNDLDbSGVY+ZV7I=
github.com/refraction-networking/utls v1.2.2-0.20230207151345-a75a4b484849/go.mod h1:L1goe44KvhnTfctUffM2isnJpSjPlYShrhXDeZaoYKw=
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg=
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstvQsPGkxUsCd2KWxErBblirPizecHcpD3ffK+s=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
Expand Down
23 changes: 15 additions & 8 deletions transport/internet/tls/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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)
}

0 comments on commit ddfe173

Please sign in to comment.