Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions u_360_profile_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package tls

import (
"net"
"reflect"
"testing"
)

func Test360Chrome23ClientHello(t *testing.T) {
conn := UClient(&net.TCPConn{}, &Config{ServerName: "example.com"}, Hello360_Auto)
if err := conn.BuildHandshakeState(); err != nil {
t.Fatal(err)
}
hello := conn.HandshakeState.Hello
shares := hello.KeyShares
if len(shares) != 3 || !isGREASEUint16(uint16(shares[0].Group)) ||
shares[1].Group != X25519MLKEM768 || len(shares[1].Data) != 1216 ||
shares[2].Group != X25519 || len(shares[2].Data) != 32 {
t.Fatal("unexpected key shares")
}
wantVersions := []uint16{VersionTLS13, VersionTLS12, VersionTLS11, VersionTLS10}
if len(hello.SupportedVersions) != len(wantVersions)+1 ||
!isGREASEUint16(hello.SupportedVersions[0]) || !reflect.DeepEqual(hello.SupportedVersions[1:], wantVersions) {
t.Fatalf("unexpected supported versions: %x", hello.SupportedVersions)
}
for _, ext := range conn.Extensions {
if alps, ok := ext.(*ApplicationSettingsExtension); ok && reflect.DeepEqual(alps.SupportedProtocols, []string{"h2"}) {
return
}
}
t.Fatal("missing old ALPS codepoint for h2")
}
3 changes: 2 additions & 1 deletion u_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,9 +662,10 @@ var (
HelloSafari_16_0 = ClientHelloID{helloSafari, "16.0", nil, nil}
HelloSafari_26_3 = ClientHelloID{helloSafari, "26.3", nil, nil}

Hello360_Auto = Hello360_7_5 // Hello360_11_0 seems to be incompatible with this library
Hello360_Auto = Hello360_23_0
Hello360_7_5 = ClientHelloID{hello360, "7.5", nil, nil}
Hello360_11_0 = ClientHelloID{hello360, "11.0", nil, nil}
Hello360_23_0 = ClientHelloID{hello360, "23.0", nil, nil}

HelloQQ_Auto = HelloQQ_11_1
HelloQQ_11_1 = ClientHelloID{helloQQ, "11.1", nil, nil}
Expand Down
14 changes: 14 additions & 0 deletions u_parrots.go
Original file line number Diff line number Diff line change
Expand Up @@ -2349,6 +2349,20 @@ func utlsIdToSpec(id ClientHelloID) (ClientHelloSpec, error) {
&UtlsGREASEExtension{},
},
}, nil
case Hello360_23_0:
spec, err := utlsIdToSpec(HelloChrome_133)
if err != nil {
return ClientHelloSpec{}, err
}
for i, ext := range spec.Extensions {
switch e := ext.(type) {
case *ApplicationSettingsExtensionNew:
spec.Extensions[i] = &ApplicationSettingsExtension{SupportedProtocols: e.SupportedProtocols}
case *SupportedVersionsExtension:
e.Versions = append(e.Versions, VersionTLS11, VersionTLS10)
}
}
return spec, nil
case Hello360_7_5:
return ClientHelloSpec{
CipherSuites: []uint16{
Expand Down