Skip to content

Commit

Permalink
Update utils.go
Browse files Browse the repository at this point in the history
  • Loading branch information
wuliao6688 committed Jan 17, 2024
1 parent b512d6c commit c0eca2c
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions transport/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,7 @@ func StringToSpec(ja3 string, userAgent string, tlsExtensions *TLSExtensions, fo
}
// parse curves
var targetCurves []utls.CurveID
if parsedUserAgent == chrome && !tlsExtensions.NotUsedGREASE {
targetCurves = append(targetCurves, utls.CurveID(utls.GREASE_PLACEHOLDER)) //append grease for Chrome browsers
if supportedVersionsExt, ok := extMap["43"]; ok {
if supportedVersions, ok := supportedVersionsExt.(*utls.SupportedVersionsExtension); ok {
supportedVersions.Versions = append([]uint16{utls.GREASE_PLACEHOLDER}, supportedVersions.Versions...)
}
}
if keyShareExt, ok := extMap["51"]; ok {
if keyShare, ok := keyShareExt.(*utls.KeyShareExtension); ok {
keyShare.KeyShares = append([]utls.KeyShare{{Group: utls.CurveID(utls.GREASE_PLACEHOLDER), Data: []byte{0}}}, keyShare.KeyShares...)
}
}
}
for _, c := range curves {
cid, err := strconv.ParseUint(c, 10, 16)
if err != nil {
return nil, err
}
targetCurves = append(targetCurves, utls.CurveID(cid))
}

extMap["10"] = &utls.SupportedCurvesExtension{Curves: targetCurves}

// parse point formats
Expand Down

0 comments on commit c0eca2c

Please sign in to comment.