├── .gitignore
├── .idea
├── hello-requests.iml
├── modules.xml
└── vcs.xml
├── README.md
├── client.go
├── compress
└── compress.go
├── go.mod
├── go.sum
├── http
├── cgi
│ ├── child.go
│ ├── host.go
│ └── testdata
│ │ └── test.cgi
├── client.go
├── clone.go
├── cookie.go
├── cookiejar
│ ├── jar.go
│ └── punycode.go
├── doc.go
├── fcgi
│ ├── child.go
│ └── fcgi.go
├── filetransport.go
├── fs.go
├── h2_bundle.go
├── header.go
├── http.go
├── httptest
│ ├── httptest.go
│ ├── recorder.go
│ └── server.go
├── httptrace
│ └── trace.go
├── httputil
│ ├── dump.go
│ ├── httputil.go
│ ├── persist.go
│ └── reverseproxy.go
├── internal
│ ├── chunked.go
│ └── testcert.go
├── jar.go
├── method.go
├── omithttp2.go
├── pprof
│ └── pprof.go
├── request.go
├── response.go
├── roundtrip.go
├── roundtrip_js.go
├── server.go
├── sniff.go
├── socks_bundle.go
├── status.go
├── testdata
│ ├── file
│ ├── index.html
│ └── style.css
├── transfer.go
├── transport.go
└── triv.go
├── internal
├── nettrace
│ └── nettrace.go
└── profile
│ ├── encode.go
│ ├── filter.go
│ ├── legacy_profile.go
│ ├── merge.go
│ ├── profile.go
│ ├── profile_test.go
│ ├── proto.go
│ ├── proto_test.go
│ └── prune.go
├── mimic
└── mimic.go
├── request.go
├── test
└── request_test.go
├── types.go
├── utils
└── utils.go
└── utls
├── .travis.yml
├── alert.go
├── auth.go
├── cipher_suites.go
├── common.go
├── conn.go
├── cpu
├── cpu.go
├── cpu_arm.go
├── cpu_arm64.go
├── cpu_mips.go
├── cpu_mips64.go
├── cpu_mips64le.go
├── cpu_mipsle.go
├── cpu_ppc64x.go
├── cpu_s390x.go
├── cpu_test.go
├── cpu_x86.go
└── cpu_x86.s
├── examples
└── examples.go
├── generate_cert.go
├── handshake_client.go
├── handshake_client_tls13.go
├── handshake_messages.go
├── handshake_server.go
├── handshake_server_tls13.go
├── key_agreement.go
├── key_schedule.go
├── local
├── facebook_test.pcapng
└── fb
│ ├── fb
│ └── main.go
├── logo.png
├── logo_small.png
├── prf.go
├── testdata
├── Client-TLSv10-ClientCert-ECDSA-ECDSA
├── Client-TLSv10-ClientCert-ECDSA-RSA
├── Client-TLSv10-ClientCert-RSA-ECDSA
├── Client-TLSv10-ClientCert-RSA-RSA
├── Client-TLSv10-ECDHE-ECDSA-AES
├── Client-TLSv10-ECDHE-RSA-AES
├── Client-TLSv10-ExportKeyingMaterial
├── Client-TLSv10-RSA-RC4
├── Client-TLSv11-ECDHE-ECDSA-AES
├── Client-TLSv11-ECDHE-RSA-AES
├── Client-TLSv11-RSA-RC4
├── Client-TLSv12-AES128-GCM-SHA256
├── Client-TLSv12-AES128-SHA256
├── Client-TLSv12-AES256-GCM-SHA384
├── Client-TLSv12-ALPN
├── Client-TLSv12-ALPN-NoMatch
├── Client-TLSv12-ClientCert-ECDSA-ECDSA
├── Client-TLSv12-ClientCert-ECDSA-RSA
├── Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384
├── Client-TLSv12-ClientCert-RSA-ECDSA
├── Client-TLSv12-ClientCert-RSA-RSA
├── Client-TLSv12-ClientCert-RSA-RSAPKCS1v15
├── Client-TLSv12-ClientCert-RSA-RSAPSS
├── Client-TLSv12-ECDHE-ECDSA-AES
├── Client-TLSv12-ECDHE-ECDSA-AES-GCM
├── Client-TLSv12-ECDHE-ECDSA-AES128-SHA256
├── Client-TLSv12-ECDHE-ECDSA-AES256-GCM-SHA384
├── Client-TLSv12-ECDHE-ECDSA-CHACHA20-POLY1305
├── Client-TLSv12-ECDHE-RSA-AES
├── Client-TLSv12-ECDHE-RSA-AES128-SHA256
├── Client-TLSv12-ECDHE-RSA-CHACHA20-POLY1305
├── Client-TLSv12-ExportKeyingMaterial
├── Client-TLSv12-P256-ECDHE
├── Client-TLSv12-RSA-RC4
├── Client-TLSv12-RenegotiateOnce
├── Client-TLSv12-RenegotiateTwice
├── Client-TLSv12-RenegotiateTwiceRejected
├── Client-TLSv12-RenegotiationRejected
├── Client-TLSv12-SCT
├── Client-TLSv12-UTLS-AES128-GCM-SHA256-Chrome-58
├── Client-TLSv12-UTLS-AES128-GCM-SHA256-Chrome-70
├── Client-TLSv12-UTLS-AES128-GCM-SHA256-Firefox-55
├── Client-TLSv12-UTLS-AES128-GCM-SHA256-Golang-0
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-GCM-SHA256-Chrome-58
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-GCM-SHA256-Chrome-58setclienthello
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-GCM-SHA256-Chrome-70
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-GCM-SHA256-Firefox-55
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-GCM-SHA256-Firefox-63
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-GCM-SHA256-Golang-0
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-SHA-Firefox-55
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-SHA-Firefox-63
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-SHA-Golang-0
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES256-GCM-SHA256-Chrome-70
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES256-SHA-Firefox-55
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES256-SHA-Firefox-63
├── Client-TLSv12-UTLS-ECDHE-ECDSA-AES256-SHA-Golang-0
├── Client-TLSv12-UTLS-ECDHE-ECDSA-CHACHA20-POLY1305-Firefox-55
├── Client-TLSv12-UTLS-ECDHE-ECDSA-CHACHA20-POLY1305-Firefox-63
├── Client-TLSv12-UTLS-ECDHE-ECDSA-CHACHA20-POLY1305-Golang-0
├── Client-TLSv12-UTLS-ECDHE-RSA-AES128-GCM-SHA256-Chrome-58
├── Client-TLSv12-UTLS-ECDHE-RSA-AES128-GCM-SHA256-Chrome-58setclienthello
├── Client-TLSv12-UTLS-ECDHE-RSA-AES128-GCM-SHA256-Chrome-70
├── Client-TLSv12-UTLS-ECDHE-RSA-AES128-GCM-SHA256-Firefox-55
├── Client-TLSv12-UTLS-ECDHE-RSA-AES128-GCM-SHA256-Firefox-63
├── Client-TLSv12-UTLS-ECDHE-RSA-AES128-GCM-SHA256-Golang-0
├── Client-TLSv12-UTLS-ECDHE-RSA-AES128-SHA-Chrome-58
├── Client-TLSv12-UTLS-ECDHE-RSA-AES128-SHA-Chrome-70
├── Client-TLSv12-UTLS-ECDHE-RSA-AES128-SHA-Firefox-55
├── Client-TLSv12-UTLS-ECDHE-RSA-AES128-SHA-Firefox-63
├── Client-TLSv12-UTLS-ECDHE-RSA-AES128-SHA-Golang-0
├── Client-TLSv12-UTLS-ECDHE-RSA-AES256-SHA-Chrome-58
├── Client-TLSv12-UTLS-ECDHE-RSA-AES256-SHA-Chrome-70
├── Client-TLSv12-UTLS-ECDHE-RSA-AES256-SHA-Firefox-55
├── Client-TLSv12-UTLS-ECDHE-RSA-AES256-SHA-Firefox-63
├── Client-TLSv12-UTLS-ECDHE-RSA-AES256-SHA-Golang-0
├── Client-TLSv12-UTLS-ECDHE-RSA-CHACHA20-POLY1305-Chrome-58
├── Client-TLSv12-UTLS-ECDHE-RSA-CHACHA20-POLY1305-Chrome-70
├── Client-TLSv12-UTLS-ECDHE-RSA-CHACHA20-POLY1305-Firefox-55
├── Client-TLSv12-UTLS-ECDHE-RSA-CHACHA20-POLY1305-Firefox-63
├── Client-TLSv12-UTLS-ECDHE-RSA-CHACHA20-POLY1305-Golang-0
├── Client-TLSv12-UTLS-setclienthello-ECDHE-RSA-AES128-GCM-SHA256-Chrome-58
├── Client-TLSv12-X25519-ECDHE
├── Client-TLSv13-AES128-SHA256
├── Client-TLSv13-AES256-SHA384
├── Client-TLSv13-ALPN
├── Client-TLSv13-CHACHA20-SHA256
├── Client-TLSv13-ClientCert-ECDSA-RSA
├── Client-TLSv13-ClientCert-RSA-ECDSA
├── Client-TLSv13-ClientCert-RSA-RSAPSS
├── Client-TLSv13-ECDSA
├── Client-TLSv13-ExportKeyingMaterial
├── Client-TLSv13-HelloRetryRequest
├── Client-TLSv13-KeyUpdate
├── Client-TLSv13-P256-ECDHE
├── Client-TLSv13-UTLS-HelloRetryRequest-Chrome-70
├── Client-TLSv13-UTLS-TLS_AES_128_GCM_SHA256-Chrome-70
├── Client-TLSv13-UTLS-TLS_AES_128_GCM_SHA256-Firefox-63
├── Client-TLSv13-UTLS-TLS_AES_256_GCM_SHA384-Chrome-70
├── Client-TLSv13-UTLS-TLS_AES_256_GCM_SHA384-Firefox-63
├── Client-TLSv13-UTLS-TLS_CHACHA20_POLY1305_SHA256-Chrome-70
├── Client-TLSv13-UTLS-TLS_CHACHA20_POLY1305_SHA256-Firefox-63
├── Client-TLSv13-X25519-ECDHE
├── Server-SSLv3-RSA-3DES
├── Server-SSLv3-RSA-AES
├── Server-SSLv3-RSA-RC4
├── Server-TLSv10-ECDHE-ECDSA-AES
├── Server-TLSv10-ExportKeyingMaterial
├── Server-TLSv10-RSA-3DES
├── Server-TLSv10-RSA-AES
├── Server-TLSv10-RSA-RC4
├── Server-TLSv11-FallbackSCSV
├── Server-TLSv11-RSA-RC4
├── Server-TLSv12-ALPN
├── Server-TLSv12-ALPN-NoMatch
├── Server-TLSv12-CipherSuiteCertPreferenceECDSA
├── Server-TLSv12-CipherSuiteCertPreferenceRSA
├── Server-TLSv12-ClientAuthRequestedAndECDSAGiven
├── Server-TLSv12-ClientAuthRequestedAndGiven
├── Server-TLSv12-ClientAuthRequestedAndPKCS1v15Given
├── Server-TLSv12-ClientAuthRequestedNotGiven
├── Server-TLSv12-ECDHE-ECDSA-AES
├── Server-TLSv12-ExportKeyingMaterial
├── Server-TLSv12-IssueTicket
├── Server-TLSv12-IssueTicketPreDisable
├── Server-TLSv12-P256
├── Server-TLSv12-RSA-3DES
├── Server-TLSv12-RSA-AES
├── Server-TLSv12-RSA-AES-GCM
├── Server-TLSv12-RSA-AES256-GCM-SHA384
├── Server-TLSv12-RSA-RC4
├── Server-TLSv12-RSA-RSAPKCS1v15
├── Server-TLSv12-RSA-RSAPSS
├── Server-TLSv12-Resume
├── Server-TLSv12-ResumeDisabled
├── Server-TLSv12-SNI
├── Server-TLSv12-SNI-GetCertificate
├── Server-TLSv12-SNI-GetCertificateNotFound
├── Server-TLSv12-X25519
├── Server-TLSv13-AES128-SHA256
├── Server-TLSv13-AES256-SHA384
├── Server-TLSv13-ALPN
├── Server-TLSv13-ALPN-NoMatch
├── Server-TLSv13-CHACHA20-SHA256
├── Server-TLSv13-ClientAuthRequestedAndECDSAGiven
├── Server-TLSv13-ClientAuthRequestedAndGiven
├── Server-TLSv13-ClientAuthRequestedNotGiven
├── Server-TLSv13-ECDHE-ECDSA-AES
├── Server-TLSv13-ExportKeyingMaterial
├── Server-TLSv13-HelloRetryRequest
├── Server-TLSv13-IssueTicket
├── Server-TLSv13-IssueTicketPreDisable
├── Server-TLSv13-P256
├── Server-TLSv13-RSA-RSAPSS
├── Server-TLSv13-Resume
├── Server-TLSv13-Resume-HelloRetryRequest
├── Server-TLSv13-ResumeDisabled
├── Server-TLSv13-X25519
├── example-cert.pem
└── example-key.pem
├── testenv
├── testenv.go
├── testenv_cgo.go
├── testenv_notwin.go
└── testenv_windows.go
├── ticket.go
├── tls.go
├── u_common.go
├── u_conn.go
├── u_parrots.go
├── u_prng.go
├── u_public.go
├── u_roller.go
├── u_tls_extensions.go
├── y_certificate_compression.go
└── y_ctaes.go
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | .idea/*
3 | .idea/workspace.xml
--------------------------------------------------------------------------------
/.idea/hello-requests.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # hello-requests
2 | Easy to use golang based request client made to be indistinguishable from popular browser/OS combinations (When configured properly)
3 |
4 | Features:
5 | - Mimic TLS client hello (most credit to https://github.com/refraction-networking/utls)
6 | - Mimic HTTP2 frames from modern browsers
7 | - Mimic HTTP2 header order from modern browsers
8 | - Custom header ordering (Outside of the H2 headers)
9 | - Custom idle connection timeouts
10 | - Custom request timeouts
11 | - Proxy support
12 | - JSON/Form Data/Query String body building
13 | - Byte request bodies can be passed in as Base64
14 |
15 |
16 | Noted:
17 | - I haven't updated any of the fingerprints in a while (mimic/mimic.go)
18 | - If no `MimicBrowser` string is passed it defaults to chrome
19 | - If you don't pass some important headers it may cause issues
20 | - Some domains may handle the TLS client hello differently and cause TLS errors
21 |
--------------------------------------------------------------------------------
/client.go:
--------------------------------------------------------------------------------
1 | package request
2 |
3 | import (
4 | "github.com/hunterbdm/hello-requests/http"
5 | "github.com/hunterbdm/hello-requests/mimic"
6 | "github.com/hunterbdm/hello-requests/utils"
7 | "strconv"
8 | "sync"
9 | "time"
10 | )
11 |
12 | var (
13 | defaultClientSettings = ClientSettings{
14 | IdleTimeoutTime: 10000,
15 | RequestTimeoutTime: 10000,
16 | MimicBrowser: "chrome",
17 | }
18 |
19 | httpClientMap = map[string]http.Client{}
20 | httpClientMapMutex = sync.RWMutex{}
21 | )
22 |
23 | type ClientSettings struct {
24 | IdleTimeoutTime int `json:"IdleTimeoutTime"`
25 | RequestTimeoutTime int `json:"RequestTimeoutTime"`
26 |
27 | SkipCertChecks bool `json:"SkipCertChecks"`
28 |
29 | Proxy string `json:"Proxy"`
30 | MimicBrowser string `json:"MimicBrowser"`
31 |
32 | CustomServerName string
33 | }
34 |
35 | // Fingerprint returns a string representation of the ClientSettings
36 | func (cs *ClientSettings) Fingerprint() string {
37 | return strconv.Itoa(cs.IdleTimeoutTime) +
38 | strconv.Itoa(cs.RequestTimeoutTime) +
39 | strconv.FormatBool(cs.SkipCertChecks) +
40 | cs.Proxy +
41 | cs.MimicBrowser
42 | }
43 |
44 | // AddDefaults combines the options from the provided
45 | // ClientSettings and the defaultClientSettings
46 | func (cs *ClientSettings) AddDefaults() {
47 | if cs.IdleTimeoutTime == 0 {
48 | cs.IdleTimeoutTime = defaultClientSettings.IdleTimeoutTime
49 | }
50 |
51 | if cs.RequestTimeoutTime == 0 {
52 | cs.RequestTimeoutTime = defaultClientSettings.RequestTimeoutTime
53 | }
54 |
55 | if cs.MimicBrowser == "" || mimic.GetMimicSettings(cs.MimicBrowser) == nil {
56 | cs.MimicBrowser = defaultClientSettings.MimicBrowser
57 | }
58 | }
59 |
60 |
61 | // SetDefaultClientSettings overrides default ClientSettings config
62 | func SetDefaultClientSettings(cs ClientSettings) {
63 | defaultClientSettings = cs
64 | }
65 |
66 | // GetHttpClient returns mapped http Clients
67 | func GetHttpClient(cs *ClientSettings) *http.Client {
68 | fp := cs.Fingerprint()
69 |
70 | httpClientMapMutex.RLock()
71 | if client, ok := httpClientMap[fp]; ok {
72 | httpClientMapMutex.RUnlock()
73 | return &client
74 | }
75 | httpClientMapMutex.RUnlock()
76 |
77 | newClient := setupHttpClient(cs)
78 |
79 | httpClientMapMutex.Lock()
80 | httpClientMap[fp] = newClient
81 | httpClientMapMutex.Unlock()
82 |
83 | return &newClient
84 | }
85 |
86 | // setupHttpClient creates a http.Client and http.Transport
87 | // that follows the options in the ClientSettings
88 | func setupHttpClient(cs *ClientSettings) http.Client {
89 | mimicSettings := mimic.GetMimicSettings(cs.MimicBrowser)
90 |
91 | tp := http.Transport{
92 | IdleConnTimeout: time.Millisecond * time.Duration(cs.IdleTimeoutTime),
93 | MimicSettings: mimicSettings,
94 | SkipCertChecks: cs.SkipCertChecks,
95 | CustomServerName: cs.CustomServerName,
96 | }
97 |
98 | // Add proxy to Transport
99 | if cs.Proxy != "" {
100 | proxyUrl, err := utils.ParseProxy(cs.Proxy)
101 |
102 | if err == nil {
103 | tp.Proxy = http.ProxyURL(proxyUrl)
104 | }
105 | }
106 |
107 | client := http.Client{
108 | Timeout: time.Millisecond * time.Duration(cs.RequestTimeoutTime),
109 | Transport: &tp,
110 | }
111 |
112 | client.CheckRedirect = followNoRedirects
113 |
114 | return client
115 | }
116 |
117 | // followNoRedirects is a CheckRedirect function that not follow any redirects
118 | func followNoRedirects(req *http.Request, via []*http.Request) error {
119 | return http.ErrUseLastResponse
120 | }
--------------------------------------------------------------------------------
/compress/compress.go:
--------------------------------------------------------------------------------
1 | package compress
2 |
3 | import (
4 | "bytes"
5 | "compress/gzip"
6 | "github.com/dsnet/compress/brotli"
7 | "io/ioutil"
8 | )
9 |
10 | func Decompress(data []byte, encoding string) string {
11 | if encoding == "gzip" {
12 | if newData, err := decompressGzip(data); err == nil {
13 | data = *newData
14 | }
15 | } else if encoding == "br" {
16 | if newData, err := decompressBrotli(data); err == nil {
17 | data = *newData
18 | }
19 | }
20 | // TODO add others later
21 |
22 | return string(data)
23 | }
24 |
25 | func decompressGzip(data []byte) (*[]byte, error) {
26 | if gr, err := gzip.NewReader(bytes.NewBuffer(data)); err != nil {
27 | return nil, err
28 | } else {
29 | defer gr.Close()
30 | data, _ = ioutil.ReadAll(gr)
31 | return &data, nil
32 | }
33 | }
34 |
35 | func decompressBrotli(data []byte) (*[]byte, error) {
36 | if gr, err := brotli.NewReader(bytes.NewBuffer(data), nil); err != nil {
37 | return nil, err
38 | } else {
39 | defer gr.Close()
40 | data, _ = ioutil.ReadAll(gr)
41 | return &data, nil
42 | }
43 | }
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/hunterbdm/hello-requests
2 |
3 | go 1.15
4 |
5 | require (
6 | github.com/dsnet/compress v0.0.1
7 | github.com/gwatts/rootcerts v0.0.0-20201102023153-a5b24c72525c
8 | gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec
9 | golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
10 | golang.org/x/net v0.0.0-20201224014010-6772e930b67b
11 | )
12 |
--------------------------------------------------------------------------------
/go.sum:
--------------------------------------------------------------------------------
1 | github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q=
2 | github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo=
3 | github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
4 | github.com/gwatts/rootcerts v0.0.0-20201102023153-a5b24c72525c h1:ymeNSiqQXiniKkB4Lwuf/+hDCG1JDYdsP6+p5/ocFxs=
5 | github.com/gwatts/rootcerts v0.0.0-20201102023153-a5b24c72525c/go.mod h1:PmcTZUaFWqfUtPPvjSVAMMzJzqfMYv6ehpPUX4nIo3Q=
6 | github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
7 | github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
8 | github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
9 | gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec h1:FpfFs4EhNehiVfzQttTuxanPIT43FtkkCFypIod8LHo=
10 | gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec/go.mod h1:BZ1RAoRPbCxum9Grlv5aeksu2H8BiKehBYooU2LFiOQ=
11 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
12 | golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f h1:aZp0e2vLN4MToVqnjNEYEtrEA8RH8U8FN1CU7JgqsPU=
13 | golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
14 | golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
15 | golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
16 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
17 | golang.org/x/net v0.0.0-20201216054612-986b41b23924 h1:QsnDpLLOKwHBBDa8nDws4DYNc/ryVW2vCpxCs09d4PY=
18 | golang.org/x/net v0.0.0-20201216054612-986b41b23924/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
19 | golang.org/x/net v0.0.0-20201224014010-6772e930b67b h1:iFwSg7t5GZmB/Q5TjiEAsdoLDrdJRC1RiF2WhuV29Qw=
20 | golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
21 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
22 | golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
23 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
24 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
25 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
26 | golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
27 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
28 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
29 | golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
30 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
31 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
32 |
--------------------------------------------------------------------------------
/http/cgi/testdata/test.cgi:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | # Copyright 2011 The Go Authors. All rights reserved.
3 | # Use of this source code is governed by a BSD-style
4 | # license that can be found in the LICENSE file.
5 | #
6 | # Test script run as a child process under cgi_test.go
7 |
8 | use strict;
9 | use Cwd;
10 |
11 | binmode STDOUT;
12 |
13 | my $q = MiniCGI->new;
14 | my $params = $q->Vars;
15 |
16 | if ($params->{"loc"}) {
17 | print "Location: $params->{loc}\r\n\r\n";
18 | exit(0);
19 | }
20 |
21 | print "Content-Type: text/html\r\n";
22 | print "X-CGI-Pid: $$\r\n";
23 | print "X-Test-Header: X-Test-Value\r\n";
24 | print "\r\n";
25 |
26 | if ($params->{"writestderr"}) {
27 | print STDERR "Hello, stderr!\n";
28 | }
29 |
30 | if ($params->{"bigresponse"}) {
31 | # 17 MB, for OS X: golang.org/issue/4958
32 | for (1..(17 * 1024)) {
33 | print "A" x 1024, "\r\n";
34 | }
35 | exit 0;
36 | }
37 |
38 | print "test=Hello CGI\r\n";
39 |
40 | foreach my $k (sort keys %$params) {
41 | print "param-$k=$params->{$k}\r\n";
42 | }
43 |
44 | foreach my $k (sort keys %ENV) {
45 | my $clean_env = $ENV{$k};
46 | $clean_env =~ s/[\n\r]//g;
47 | print "env-$k=$clean_env\r\n";
48 | }
49 |
50 | # NOTE: msys perl returns /c/go/src/... not C:\go\....
51 | my $dir = getcwd();
52 | if ($^O eq 'MSWin32' || $^O eq 'msys' || $^O eq 'cygwin') {
53 | if ($dir =~ /^.:/) {
54 | $dir =~ s!/!\\!g;
55 | } else {
56 | my $cmd = $ENV{'COMSPEC'} || 'c:\\windows\\system32\\cmd.exe';
57 | $cmd =~ s!\\!/!g;
58 | $dir = `$cmd /c cd`;
59 | chomp $dir;
60 | }
61 | }
62 | print "cwd=$dir\r\n";
63 |
64 | # A minimal version of CGI.pm, for people without the perl-modules
65 | # package installed. (CGI.pm used to be part of the Perl core, but
66 | # some distros now bundle perl-base and perl-modules separately...)
67 | package MiniCGI;
68 |
69 | sub new {
70 | my $class = shift;
71 | return bless {}, $class;
72 | }
73 |
74 | sub Vars {
75 | my $self = shift;
76 | my $pairs;
77 | if ($ENV{CONTENT_LENGTH}) {
78 | $pairs = do { local $/; };
79 | } else {
80 | $pairs = $ENV{QUERY_STRING};
81 | }
82 | my $vars = {};
83 | foreach my $kv (split(/&/, $pairs)) {
84 | my ($k, $v) = split(/=/, $kv, 2);
85 | $vars->{_urldecode($k)} = _urldecode($v);
86 | }
87 | return $vars;
88 | }
89 |
90 | sub _urldecode {
91 | my $v = shift;
92 | $v =~ tr/+/ /;
93 | $v =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
94 | return $v;
95 | }
96 |
--------------------------------------------------------------------------------
/http/clone.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package http
6 |
7 | import (
8 | "mime/multipart"
9 | "net/textproto"
10 | "net/url"
11 | )
12 |
13 | func cloneURLValues(v url.Values) url.Values {
14 | if v == nil {
15 | return nil
16 | }
17 | // http.Header and url.Values have the same representation, so temporarily
18 | // treat it like http.Header, which does have a clone:
19 | return url.Values(Header(v).Clone())
20 | }
21 |
22 | func cloneURL(u *url.URL) *url.URL {
23 | if u == nil {
24 | return nil
25 | }
26 | u2 := new(url.URL)
27 | *u2 = *u
28 | if u.User != nil {
29 | u2.User = new(url.Userinfo)
30 | *u2.User = *u.User
31 | }
32 | return u2
33 | }
34 |
35 | func cloneMultipartForm(f *multipart.Form) *multipart.Form {
36 | if f == nil {
37 | return nil
38 | }
39 | f2 := &multipart.Form{
40 | Value: (map[string][]string)(Header(f.Value).Clone()),
41 | }
42 | if f.File != nil {
43 | m := make(map[string][]*multipart.FileHeader)
44 | for k, vv := range f.File {
45 | vv2 := make([]*multipart.FileHeader, len(vv))
46 | for i, v := range vv {
47 | vv2[i] = cloneMultipartFileHeader(v)
48 | }
49 | m[k] = vv2
50 | }
51 | f2.File = m
52 | }
53 | return f2
54 | }
55 |
56 | func cloneMultipartFileHeader(fh *multipart.FileHeader) *multipart.FileHeader {
57 | if fh == nil {
58 | return nil
59 | }
60 | fh2 := new(multipart.FileHeader)
61 | *fh2 = *fh
62 | fh2.Header = textproto.MIMEHeader(Header(fh.Header).Clone())
63 | return fh2
64 | }
65 |
66 | // cloneOrMakeHeader invokes Header.Clone but if the
67 | // result is nil, it'll instead make and return a non-nil Header.
68 | func cloneOrMakeHeader(hdr Header) Header {
69 | clone := hdr.Clone()
70 | if clone == nil {
71 | clone = make(Header)
72 | }
73 | return clone
74 | }
75 |
--------------------------------------------------------------------------------
/http/cookiejar/punycode.go:
--------------------------------------------------------------------------------
1 | // Copyright 2012 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package cookiejar
6 |
7 | // This file implements the Punycode algorithm from RFC 3492.
8 |
9 | import (
10 | "fmt"
11 | "strings"
12 | "unicode/utf8"
13 | )
14 |
15 | // These parameter values are specified in section 5.
16 | //
17 | // All computation is done with int32s, so that overflow behavior is identical
18 | // regardless of whether int is 32-bit or 64-bit.
19 | const (
20 | base int32 = 36
21 | damp int32 = 700
22 | initialBias int32 = 72
23 | initialN int32 = 128
24 | skew int32 = 38
25 | tmax int32 = 26
26 | tmin int32 = 1
27 | )
28 |
29 | // encode encodes a string as specified in section 6.3 and prepends prefix to
30 | // the result.
31 | //
32 | // The "while h < length(input)" line in the specification becomes "for
33 | // remaining != 0" in the Go code, because len(s) in Go is in bytes, not runes.
34 | func encode(prefix, s string) (string, error) {
35 | output := make([]byte, len(prefix), len(prefix)+1+2*len(s))
36 | copy(output, prefix)
37 | delta, n, bias := int32(0), initialN, initialBias
38 | b, remaining := int32(0), int32(0)
39 | for _, r := range s {
40 | if r < utf8.RuneSelf {
41 | b++
42 | output = append(output, byte(r))
43 | } else {
44 | remaining++
45 | }
46 | }
47 | h := b
48 | if b > 0 {
49 | output = append(output, '-')
50 | }
51 | for remaining != 0 {
52 | m := int32(0x7fffffff)
53 | for _, r := range s {
54 | if m > r && r >= n {
55 | m = r
56 | }
57 | }
58 | delta += (m - n) * (h + 1)
59 | if delta < 0 {
60 | return "", fmt.Errorf("cookiejar: invalid label %q", s)
61 | }
62 | n = m
63 | for _, r := range s {
64 | if r < n {
65 | delta++
66 | if delta < 0 {
67 | return "", fmt.Errorf("cookiejar: invalid label %q", s)
68 | }
69 | continue
70 | }
71 | if r > n {
72 | continue
73 | }
74 | q := delta
75 | for k := base; ; k += base {
76 | t := k - bias
77 | if t < tmin {
78 | t = tmin
79 | } else if t > tmax {
80 | t = tmax
81 | }
82 | if q < t {
83 | break
84 | }
85 | output = append(output, encodeDigit(t+(q-t)%(base-t)))
86 | q = (q - t) / (base - t)
87 | }
88 | output = append(output, encodeDigit(q))
89 | bias = adapt(delta, h+1, h == b)
90 | delta = 0
91 | h++
92 | remaining--
93 | }
94 | delta++
95 | n++
96 | }
97 | return string(output), nil
98 | }
99 |
100 | func encodeDigit(digit int32) byte {
101 | switch {
102 | case 0 <= digit && digit < 26:
103 | return byte(digit + 'a')
104 | case 26 <= digit && digit < 36:
105 | return byte(digit + ('0' - 26))
106 | }
107 | panic("cookiejar: internal error in punycode encoding")
108 | }
109 |
110 | // adapt is the bias adaptation function specified in section 6.1.
111 | func adapt(delta, numPoints int32, firstTime bool) int32 {
112 | if firstTime {
113 | delta /= damp
114 | } else {
115 | delta /= 2
116 | }
117 | delta += delta / numPoints
118 | k := int32(0)
119 | for delta > ((base-tmin)*tmax)/2 {
120 | delta /= base - tmin
121 | k += base
122 | }
123 | return k + (base-tmin+1)*delta/(delta+skew)
124 | }
125 |
126 | // Strictly speaking, the remaining code below deals with IDNA (RFC 5890 and
127 | // friends) and not Punycode (RFC 3492) per se.
128 |
129 | // acePrefix is the ASCII Compatible Encoding prefix.
130 | const acePrefix = "xn--"
131 |
132 | // toASCII converts a domain or domain label to its ASCII form. For example,
133 | // toASCII("bücher.example.com") is "xn--bcher-kva.example.com", and
134 | // toASCII("golang") is "golang".
135 | func toASCII(s string) (string, error) {
136 | if ascii(s) {
137 | return s, nil
138 | }
139 | labels := strings.Split(s, ".")
140 | for i, label := range labels {
141 | if !ascii(label) {
142 | a, err := encode(acePrefix, label)
143 | if err != nil {
144 | return "", err
145 | }
146 | labels[i] = a
147 | }
148 | }
149 | return strings.Join(labels, "."), nil
150 | }
151 |
152 | func ascii(s string) bool {
153 | for i := 0; i < len(s); i++ {
154 | if s[i] >= utf8.RuneSelf {
155 | return false
156 | }
157 | }
158 | return true
159 | }
160 |
--------------------------------------------------------------------------------
/http/doc.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | /*
6 | Package http provides HTTP client and server implementations.
7 |
8 | Get, Head, Post, and PostForm make HTTP (or HTTPS) requests:
9 |
10 | resp, err := http.Get("http://example.com/")
11 | ...
12 | resp, err := http.Post("http://example.com/upload", "image/jpeg", &buf)
13 | ...
14 | resp, err := http.PostForm("http://example.com/form",
15 | url.Values{"key": {"Value"}, "id": {"123"}})
16 |
17 | The client must close the response body when finished with it:
18 |
19 | resp, err := http.Get("http://example.com/")
20 | if err != nil {
21 | // handle error
22 | }
23 | defer resp.Body.Close()
24 | body, err := ioutil.ReadAll(resp.Body)
25 | // ...
26 |
27 | For control over HTTP client headers, redirect policy, and other
28 | settings, create a Client:
29 |
30 | client := &http.Client{
31 | CheckRedirect: redirectPolicyFunc,
32 | }
33 |
34 | resp, err := client.Get("http://example.com")
35 | // ...
36 |
37 | req, err := http.NewRequest("GET", "http://example.com", nil)
38 | // ...
39 | req.Header.Add("If-None-Match", `W/"wyzzy"`)
40 | resp, err := client.Do(req)
41 | // ...
42 |
43 | For control over proxies, TLS configuration, keep-alives,
44 | compression, and other settings, create a Transport:
45 |
46 | tr := &http.Transport{
47 | MaxIdleConns: 10,
48 | IdleConnTimeout: 30 * time.Second,
49 | DisableCompression: true,
50 | }
51 | client := &http.Client{Transport: tr}
52 | resp, err := client.Get("https://example.com")
53 |
54 | Clients and Transports are safe for concurrent use by multiple
55 | goroutines and for efficiency should only be created once and re-used.
56 |
57 | ListenAndServe starts an HTTP server with a given address and handler.
58 | The handler is usually nil, which means to use DefaultServeMux.
59 | Handle and HandleFunc add handlers to DefaultServeMux:
60 |
61 | http.Handle("/foo", fooHandler)
62 |
63 | http.HandleFunc("/bar", func(w http.ResponseWriter, r *http.Request) {
64 | fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
65 | })
66 |
67 | log.Fatal(http.ListenAndServe(":8080", nil))
68 |
69 | More control over the server's behavior is available by creating a
70 | custom Server:
71 |
72 | s := &http.Server{
73 | Addr: ":8080",
74 | Handler: myHandler,
75 | ReadTimeout: 10 * time.Second,
76 | WriteTimeout: 10 * time.Second,
77 | MaxHeaderBytes: 1 << 20,
78 | }
79 | log.Fatal(s.ListenAndServe())
80 |
81 | Starting with Go 1.6, the http package has transparent support for the
82 | HTTP/2 protocol when using HTTPS. Programs that must disable HTTP/2
83 | can do so by setting Transport.TLSNextProto (for clients) or
84 | Server.TLSNextProto (for servers) to a non-nil, empty
85 | map. Alternatively, the following GODEBUG environment variables are
86 | currently supported:
87 |
88 | GODEBUG=http2client=0 # disable HTTP/2 client support
89 | GODEBUG=http2server=0 # disable HTTP/2 server support
90 | GODEBUG=http2debug=1 # enable verbose HTTP/2 debug logs
91 | GODEBUG=http2debug=2 # ... even more verbose, with frame dumps
92 |
93 | The GODEBUG variables are not covered by Go's API compatibility
94 | promise. Please report any issues before disabling HTTP/2
95 | support: https://golang.org/s/http2bug
96 |
97 | The http package's Transport and Server both automatically enable
98 | HTTP/2 support for simple configurations. To enable HTTP/2 for more
99 | complex configurations, to use lower-level HTTP/2 features, or to use
100 | a newer version of Go's http2 package, import "golang.org/x/net/http2"
101 | directly and use its ConfigureTransport and/or ConfigureServer
102 | functions. Manually configuring HTTP/2 via the golang.org/x/net/http2
103 | package takes precedence over the net/http package's built-in HTTP/2
104 | support.
105 |
106 | */
107 | package http
108 |
--------------------------------------------------------------------------------
/http/filetransport.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package http
6 |
7 | import (
8 | "fmt"
9 | "io"
10 | )
11 |
12 | // fileTransport implements RoundTripper for the 'file' protocol.
13 | type fileTransport struct {
14 | fh fileHandler
15 | }
16 |
17 | // NewFileTransport returns a new RoundTripper, serving the provided
18 | // FileSystem. The returned RoundTripper ignores the URL host in its
19 | // incoming requests, as well as most other properties of the
20 | // request.
21 | //
22 | // The typical use case for NewFileTransport is to register the "file"
23 | // protocol with a Transport, as in:
24 | //
25 | // t := &http.Transport{}
26 | // t.RegisterProtocol("file", http.NewFileTransport(http.Dir("/")))
27 | // c := &http.Client{Transport: t}
28 | // res, err := c.Get("file:///etc/passwd")
29 | // ...
30 | func NewFileTransport(fs FileSystem) RoundTripper {
31 | return fileTransport{fileHandler{fs}}
32 | }
33 |
34 | func (t fileTransport) RoundTrip(req *Request) (resp *Response, err error) {
35 | // We start ServeHTTP in a goroutine, which may take a long
36 | // time if the file is large. The newPopulateResponseWriter
37 | // call returns a channel which either ServeHTTP or finish()
38 | // sends our *Response on, once the *Response itself has been
39 | // populated (even if the body itself is still being
40 | // written to the res.Body, a pipe)
41 | rw, resc := newPopulateResponseWriter()
42 | go func() {
43 | t.fh.ServeHTTP(rw, req)
44 | rw.finish()
45 | }()
46 | return <-resc, nil
47 | }
48 |
49 | func newPopulateResponseWriter() (*populateResponse, <-chan *Response) {
50 | pr, pw := io.Pipe()
51 | rw := &populateResponse{
52 | ch: make(chan *Response),
53 | pw: pw,
54 | res: &Response{
55 | Proto: "HTTP/1.0",
56 | ProtoMajor: 1,
57 | Header: make(Header),
58 | Close: true,
59 | Body: pr,
60 | },
61 | }
62 | return rw, rw.ch
63 | }
64 |
65 | // populateResponse is a ResponseWriter that populates the *Response
66 | // in res, and writes its body to a pipe connected to the response
67 | // body. Once writes begin or finish() is called, the response is sent
68 | // on ch.
69 | type populateResponse struct {
70 | res *Response
71 | ch chan *Response
72 | wroteHeader bool
73 | hasContent bool
74 | sentResponse bool
75 | pw *io.PipeWriter
76 | }
77 |
78 | func (pr *populateResponse) finish() {
79 | if !pr.wroteHeader {
80 | pr.WriteHeader(500)
81 | }
82 | if !pr.sentResponse {
83 | pr.sendResponse()
84 | }
85 | pr.pw.Close()
86 | }
87 |
88 | func (pr *populateResponse) sendResponse() {
89 | if pr.sentResponse {
90 | return
91 | }
92 | pr.sentResponse = true
93 |
94 | if pr.hasContent {
95 | pr.res.ContentLength = -1
96 | }
97 | pr.ch <- pr.res
98 | }
99 |
100 | func (pr *populateResponse) Header() Header {
101 | return pr.res.Header
102 | }
103 |
104 | func (pr *populateResponse) WriteHeader(code int) {
105 | if pr.wroteHeader {
106 | return
107 | }
108 | pr.wroteHeader = true
109 |
110 | pr.res.StatusCode = code
111 | pr.res.Status = fmt.Sprintf("%d %s", code, StatusText(code))
112 | }
113 |
114 | func (pr *populateResponse) Write(p []byte) (n int, err error) {
115 | if !pr.wroteHeader {
116 | pr.WriteHeader(StatusOK)
117 | }
118 | pr.hasContent = true
119 | if !pr.sentResponse {
120 | pr.sendResponse()
121 | }
122 | return pr.pw.Write(p)
123 | }
124 |
--------------------------------------------------------------------------------
/http/http.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | //go:generate bundle -o=h2_bundle.go -prefix=http2 -tags=!nethttpomithttp2 golang.org/x/net/http2
6 |
7 | package http
8 |
9 | import (
10 | "io"
11 | "strconv"
12 | "strings"
13 | "time"
14 | "unicode/utf8"
15 |
16 | "golang.org/x/net/http/httpguts"
17 | )
18 |
19 | // incomparable is a zero-width, non-comparable type. Adding it to a struct
20 | // makes that struct also non-comparable, and generally doesn't add
21 | // any size (as long as it's first).
22 | type incomparable [0]func()
23 |
24 | // maxInt64 is the effective "infinite" value for the Server and
25 | // Transport's byte-limiting readers.
26 | const maxInt64 = 1<<63 - 1
27 |
28 | // aLongTimeAgo is a non-zero time, far in the past, used for
29 | // immediate cancellation of network operations.
30 | var aLongTimeAgo = time.Unix(1, 0)
31 |
32 | // omitBundledHTTP2 is set by omithttp2.go when the nethttpomithttp2
33 | // build tag is set. That means h2_bundle.go isn't compiled in and we
34 | // shouldn't try to use it.
35 | var omitBundledHTTP2 bool
36 |
37 | // TODO(bradfitz): move common stuff here. The other files have accumulated
38 | // generic http stuff in random places.
39 |
40 | // contextKey is a value for use with context.WithValue. It's used as
41 | // a pointer so it fits in an interface{} without allocation.
42 | type contextKey struct {
43 | name string
44 | }
45 |
46 | func (k *contextKey) String() string { return "net/http context value " + k.name }
47 |
48 | // Given a string of the form "host", "host:port", or "[ipv6::address]:port",
49 | // return true if the string includes a port.
50 | func hasPort(s string) bool { return strings.LastIndex(s, ":") > strings.LastIndex(s, "]") }
51 |
52 | // removeEmptyPort strips the empty port in ":port" to ""
53 | // as mandated by RFC 3986 Section 6.2.3.
54 | func removeEmptyPort(host string) string {
55 | if hasPort(host) {
56 | return strings.TrimSuffix(host, ":")
57 | }
58 | return host
59 | }
60 |
61 | func isNotToken(r rune) bool {
62 | return !httpguts.IsTokenRune(r)
63 | }
64 |
65 | func isASCII(s string) bool {
66 | for i := 0; i < len(s); i++ {
67 | if s[i] >= utf8.RuneSelf {
68 | return false
69 | }
70 | }
71 | return true
72 | }
73 |
74 | // stringContainsCTLByte reports whether s contains any ASCII control character.
75 | func stringContainsCTLByte(s string) bool {
76 | for i := 0; i < len(s); i++ {
77 | b := s[i]
78 | if b < ' ' || b == 0x7f {
79 | return true
80 | }
81 | }
82 | return false
83 | }
84 |
85 | func hexEscapeNonASCII(s string) string {
86 | newLen := 0
87 | for i := 0; i < len(s); i++ {
88 | if s[i] >= utf8.RuneSelf {
89 | newLen += 3
90 | } else {
91 | newLen++
92 | }
93 | }
94 | if newLen == len(s) {
95 | return s
96 | }
97 | b := make([]byte, 0, newLen)
98 | for i := 0; i < len(s); i++ {
99 | if s[i] >= utf8.RuneSelf {
100 | b = append(b, '%')
101 | b = strconv.AppendInt(b, int64(s[i]), 16)
102 | } else {
103 | b = append(b, s[i])
104 | }
105 | }
106 | return string(b)
107 | }
108 |
109 | // NoBody is an io.ReadCloser with no bytes. Read always returns EOF
110 | // and Close always returns nil. It can be used in an outgoing client
111 | // request to explicitly signal that a request has zero bytes.
112 | // An alternative, however, is to simply set Request.Body to nil.
113 | var NoBody = noBody{}
114 |
115 | type noBody struct{}
116 |
117 | func (noBody) Read([]byte) (int, error) { return 0, io.EOF }
118 | func (noBody) Close() error { return nil }
119 | func (noBody) WriteTo(io.Writer) (int64, error) { return 0, nil }
120 |
121 | var (
122 | // verify that an io.Copy from NoBody won't require a buffer:
123 | _ io.WriterTo = NoBody
124 | _ io.ReadCloser = NoBody
125 | )
126 |
127 | // PushOptions describes options for Pusher.Push.
128 | type PushOptions struct {
129 | // Method specifies the HTTP method for the promised request.
130 | // If set, it must be "GET" or "HEAD". Empty means "GET".
131 | Method string
132 |
133 | // Header specifies additional promised request headers. This cannot
134 | // include HTTP/2 pseudo header fields like ":path" and ":scheme",
135 | // which will be added automatically.
136 | Header Header
137 | }
138 |
139 | // Pusher is the interface implemented by ResponseWriters that support
140 | // HTTP/2 server push. For more background, see
141 | // https://tools.ietf.org/html/rfc7540#section-8.2.
142 | type Pusher interface {
143 | // Push initiates an HTTP/2 server push. This constructs a synthetic
144 | // request using the given target and options, serializes that request
145 | // into a PUSH_PROMISE frame, then dispatches that request using the
146 | // server's request handler. If opts is nil, default options are used.
147 | //
148 | // The target must either be an absolute path (like "/path") or an absolute
149 | // URL that contains a valid host and the same scheme as the parent request.
150 | // If the target is a path, it will inherit the scheme and host of the
151 | // parent request.
152 | //
153 | // The HTTP/2 spec disallows recursive pushes and cross-authority pushes.
154 | // Push may or may not detect these invalid pushes; however, invalid
155 | // pushes will be detected and canceled by conforming clients.
156 | //
157 | // Handlers that wish to push URL X should call Push before sending any
158 | // data that may trigger a request for URL X. This avoids a race where the
159 | // client issues requests for X before receiving the PUSH_PROMISE for X.
160 | //
161 | // Push will run in a separate goroutine making the order of arrival
162 | // non-deterministic. Any required synchronization needs to be implemented
163 | // by the caller.
164 | //
165 | // Push returns ErrNotSupported if the client has disabled push or if push
166 | // is not supported on the underlying connection.
167 | Push(target string, opts *PushOptions) error
168 | }
169 |
--------------------------------------------------------------------------------
/http/httptest/httptest.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package httptest provides utilities for HTTP testing.
6 | package httptest
7 |
8 | import (
9 | "bufio"
10 | "bytes"
11 | "github.com/hunterbdm/hello-requests/utls"
12 | "io"
13 | "io/ioutil"
14 | "github.com/hunterbdm/hello-requests/http"
15 | "strings"
16 | )
17 |
18 | // NewRequest returns a new incoming server Request, suitable
19 | // for passing to an http.Handler for testing.
20 | //
21 | // The target is the RFC 7230 "request-target": it may be either a
22 | // path or an absolute URL. If target is an absolute URL, the host name
23 | // from the URL is used. Otherwise, "example.com" is used.
24 | //
25 | // The TLS field is set to a non-nil dummy value if target has scheme
26 | // "https".
27 | //
28 | // The Request.Proto is always HTTP/1.1.
29 | //
30 | // An empty method means "GET".
31 | //
32 | // The provided body may be nil. If the body is of type *bytes.Reader,
33 | // *strings.Reader, or *bytes.Buffer, the Request.ContentLength is
34 | // set.
35 | //
36 | // NewRequest panics on error for ease of use in testing, where a
37 | // panic is acceptable.
38 | //
39 | // To generate a client HTTP request instead of a server request, see
40 | // the NewRequest function in the net/http package.
41 | func NewRequest(method, target string, body io.Reader) *http.Request {
42 | if method == "" {
43 | method = "GET"
44 | }
45 | req, err := http.ReadRequest(bufio.NewReader(strings.NewReader(method + " " + target + " HTTP/1.0\r\n\r\n")))
46 | if err != nil {
47 | panic("invalid NewRequest arguments; " + err.Error())
48 | }
49 |
50 | // HTTP/1.0 was used above to avoid needing a Host field. Change it to 1.1 here.
51 | req.Proto = "HTTP/1.1"
52 | req.ProtoMinor = 1
53 | req.Close = false
54 |
55 | if body != nil {
56 | switch v := body.(type) {
57 | case *bytes.Buffer:
58 | req.ContentLength = int64(v.Len())
59 | case *bytes.Reader:
60 | req.ContentLength = int64(v.Len())
61 | case *strings.Reader:
62 | req.ContentLength = int64(v.Len())
63 | default:
64 | req.ContentLength = -1
65 | }
66 | if rc, ok := body.(io.ReadCloser); ok {
67 | req.Body = rc
68 | } else {
69 | req.Body = ioutil.NopCloser(body)
70 | }
71 | }
72 |
73 | // 192.0.2.0/24 is "TEST-NET" in RFC 5737 for use solely in
74 | // documentation and example source code and should not be
75 | // used publicly.
76 | req.RemoteAddr = "192.0.2.1:1234"
77 |
78 | if req.Host == "" {
79 | req.Host = "example.com"
80 | }
81 |
82 | if strings.HasPrefix(target, "https://") {
83 | req.TLS = &tls.ConnectionState{
84 | Version: tls.VersionTLS12,
85 | HandshakeComplete: true,
86 | ServerName: req.Host,
87 | }
88 | }
89 |
90 | return req
91 | }
92 |
--------------------------------------------------------------------------------
/http/httputil/httputil.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package httputil provides HTTP utility functions, complementing the
6 | // more common ones in the net/http package.
7 | package httputil
8 |
9 | import (
10 | "io"
11 | "github.com/hunterbdm/hello-requests/http/internal"
12 | )
13 |
14 | // NewChunkedReader returns a new chunkedReader that translates the data read from r
15 | // out of HTTP "chunked" format before returning it.
16 | // The chunkedReader returns io.EOF when the final 0-length chunk is read.
17 | //
18 | // NewChunkedReader is not needed by normal applications. The http package
19 | // automatically decodes chunking when reading response bodies.
20 | func NewChunkedReader(r io.Reader) io.Reader {
21 | return internal.NewChunkedReader(r)
22 | }
23 |
24 | // NewChunkedWriter returns a new chunkedWriter that translates writes into HTTP
25 | // "chunked" format before writing them to w. Closing the returned chunkedWriter
26 | // sends the final 0-length chunk that marks the end of the stream but does
27 | // not send the final CRLF that appears after trailers; trailers and the last
28 | // CRLF must be written separately.
29 | //
30 | // NewChunkedWriter is not needed by normal applications. The http
31 | // package adds chunking automatically if handlers don't set a
32 | // Content-Length header. Using NewChunkedWriter inside a handler
33 | // would result in double chunking or chunking with a Content-Length
34 | // length, both of which are wrong.
35 | func NewChunkedWriter(w io.Writer) io.WriteCloser {
36 | return internal.NewChunkedWriter(w)
37 | }
38 |
39 | // ErrLineTooLong is returned when reading malformed chunked data
40 | // with lines that are too long.
41 | var ErrLineTooLong = internal.ErrLineTooLong
42 |
--------------------------------------------------------------------------------
/http/internal/testcert.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package internal
6 |
7 | import "strings"
8 |
9 | // LocalhostCert is a PEM-encoded TLS cert with SAN IPs
10 | // "127.0.0.1" and "[::1]", expiring at Jan 29 16:00:00 2084 GMT.
11 | // generated from src/crypto/tls:
12 | // go run generate_cert.go --rsa-bits 1024 --host 127.0.0.1,::1,example.com --ca --start-date "Jan 1 00:00:00 1970" --duration=1000000h
13 | var LocalhostCert = []byte(`-----BEGIN CERTIFICATE-----
14 | MIICEzCCAXygAwIBAgIQMIMChMLGrR+QvmQvpwAU6zANBgkqhkiG9w0BAQsFADAS
15 | MRAwDgYDVQQKEwdBY21lIENvMCAXDTcwMDEwMTAwMDAwMFoYDzIwODQwMTI5MTYw
16 | MDAwWjASMRAwDgYDVQQKEwdBY21lIENvMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
17 | iQKBgQDuLnQAI3mDgey3VBzWnB2L39JUU4txjeVE6myuDqkM/uGlfjb9SjY1bIw4
18 | iA5sBBZzHi3z0h1YV8QPuxEbi4nW91IJm2gsvvZhIrCHS3l6afab4pZBl2+XsDul
19 | rKBxKKtD1rGxlG4LjncdabFn9gvLZad2bSysqz/qTAUStTvqJQIDAQABo2gwZjAO
20 | BgNVHQ8BAf8EBAMCAqQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDwYDVR0TAQH/BAUw
21 | AwEB/zAuBgNVHREEJzAlggtleGFtcGxlLmNvbYcEfwAAAYcQAAAAAAAAAAAAAAAA
22 | AAAAATANBgkqhkiG9w0BAQsFAAOBgQCEcetwO59EWk7WiJsG4x8SY+UIAA+flUI9
23 | tyC4lNhbcF2Idq9greZwbYCqTTTr2XiRNSMLCOjKyI7ukPoPjo16ocHj+P3vZGfs
24 | h1fIw3cSS2OolhloGw/XM6RWPWtPAlGykKLciQrBru5NAPvCMsb/I1DAceTiotQM
25 | fblo6RBxUQ==
26 | -----END CERTIFICATE-----`)
27 |
28 | // LocalhostKey is the private key for localhostCert.
29 | var LocalhostKey = []byte(testingKey(`-----BEGIN RSA TESTING KEY-----
30 | MIICXgIBAAKBgQDuLnQAI3mDgey3VBzWnB2L39JUU4txjeVE6myuDqkM/uGlfjb9
31 | SjY1bIw4iA5sBBZzHi3z0h1YV8QPuxEbi4nW91IJm2gsvvZhIrCHS3l6afab4pZB
32 | l2+XsDulrKBxKKtD1rGxlG4LjncdabFn9gvLZad2bSysqz/qTAUStTvqJQIDAQAB
33 | AoGAGRzwwir7XvBOAy5tM/uV6e+Zf6anZzus1s1Y1ClbjbE6HXbnWWF/wbZGOpet
34 | 3Zm4vD6MXc7jpTLryzTQIvVdfQbRc6+MUVeLKwZatTXtdZrhu+Jk7hx0nTPy8Jcb
35 | uJqFk541aEw+mMogY/xEcfbWd6IOkp+4xqjlFLBEDytgbIECQQDvH/E6nk+hgN4H
36 | qzzVtxxr397vWrjrIgPbJpQvBsafG7b0dA4AFjwVbFLmQcj2PprIMmPcQrooz8vp
37 | jy4SHEg1AkEA/v13/5M47K9vCxmb8QeD/asydfsgS5TeuNi8DoUBEmiSJwma7FXY
38 | fFUtxuvL7XvjwjN5B30pNEbc6Iuyt7y4MQJBAIt21su4b3sjXNueLKH85Q+phy2U
39 | fQtuUE9txblTu14q3N7gHRZB4ZMhFYyDy8CKrN2cPg/Fvyt0Xlp/DoCzjA0CQQDU
40 | y2ptGsuSmgUtWj3NM9xuwYPm+Z/F84K6+ARYiZ6PYj013sovGKUFfYAqVXVlxtIX
41 | qyUBnu3X9ps8ZfjLZO7BAkEAlT4R5Yl6cGhaJQYZHOde3JEMhNRcVFMO8dJDaFeo
42 | f9Oeos0UUothgiDktdQHxdNEwLjQf7lJJBzV+5OtwswCWA==
43 | -----END RSA TESTING KEY-----`))
44 |
45 | func testingKey(s string) string { return strings.ReplaceAll(s, "TESTING KEY", "PRIVATE KEY") }
46 |
--------------------------------------------------------------------------------
/http/jar.go:
--------------------------------------------------------------------------------
1 | // Copyright 2011 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package http
6 |
7 | import (
8 | "net/url"
9 | )
10 |
11 | // A CookieJar manages storage and use of cookies in HTTP requests.
12 | //
13 | // Implementations of CookieJar must be safe for concurrent use by multiple
14 | // goroutines.
15 | //
16 | // The net/http/cookiejar package provides a CookieJar implementation.
17 | type CookieJar interface {
18 | // SetCookies handles the receipt of the cookies in a reply for the
19 | // given URL. It may or may not choose to save the cookies, depending
20 | // on the jar's policy and implementation.
21 | SetCookies(u *url.URL, cookies []*Cookie)
22 |
23 | // Cookies returns the cookies to send in a request for the given URL.
24 | // It is up to the implementation to honor the standard cookie use
25 | // restrictions such as in RFC 6265.
26 | Cookies(u *url.URL) []*Cookie
27 | }
28 |
--------------------------------------------------------------------------------
/http/method.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package http
6 |
7 | // Common HTTP methods.
8 | //
9 | // Unless otherwise noted, these are defined in RFC 7231 section 4.3.
10 | const (
11 | MethodGet = "GET"
12 | MethodHead = "HEAD"
13 | MethodPost = "POST"
14 | MethodPut = "PUT"
15 | MethodPatch = "PATCH" // RFC 5789
16 | MethodDelete = "DELETE"
17 | MethodConnect = "CONNECT"
18 | MethodOptions = "OPTIONS"
19 | MethodTrace = "TRACE"
20 | )
21 |
--------------------------------------------------------------------------------
/http/omithttp2.go:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build nethttpomithttp2
6 |
7 | package http
8 |
9 | import (
10 | "errors"
11 | "sync"
12 | "time"
13 | )
14 |
15 | func init() {
16 | omitBundledHTTP2 = true
17 | }
18 |
19 | const noHTTP2 = "no bundled HTTP/2" // should never see this
20 |
21 | var http2errRequestCanceled = errors.New("net/http: request canceled")
22 |
23 | var http2goAwayTimeout = 1 * time.Second
24 |
25 | const http2NextProtoTLS = "h2"
26 |
27 | type http2Transport struct {
28 | MaxHeaderListSize uint32
29 | ConnPool interface{}
30 | }
31 |
32 | func (*http2Transport) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
33 | func (*http2Transport) CloseIdleConnections() {}
34 |
35 | type http2erringRoundTripper struct{ err error }
36 |
37 | func (http2erringRoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
38 |
39 | type http2noDialH2RoundTripper struct{}
40 |
41 | func (http2noDialH2RoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
42 |
43 | type http2noDialClientConnPool struct {
44 | http2clientConnPool http2clientConnPool
45 | }
46 |
47 | type http2clientConnPool struct {
48 | mu *sync.Mutex
49 | conns map[string][]struct{}
50 | }
51 |
52 | func http2configureTransport(*Transport) (*http2Transport, error) { panic(noHTTP2) }
53 |
54 | func http2isNoCachedConnError(err error) bool {
55 | _, ok := err.(interface{ IsHTTP2NoCachedConnError() })
56 | return ok
57 | }
58 |
59 | type http2Server struct {
60 | NewWriteScheduler func() http2WriteScheduler
61 | }
62 |
63 | type http2WriteScheduler interface{}
64 |
65 | func http2NewPriorityWriteScheduler(interface{}) http2WriteScheduler { panic(noHTTP2) }
66 |
67 | func http2ConfigureServer(s *Server, conf *http2Server) error { panic(noHTTP2) }
68 |
69 | var http2ErrNoCachedConn = http2noCachedConnError{}
70 |
71 | type http2noCachedConnError struct{}
72 |
73 | func (http2noCachedConnError) IsHTTP2NoCachedConnError() {}
74 |
75 | func (http2noCachedConnError) Error() string { return "http2: no cached connection was available" }
76 |
--------------------------------------------------------------------------------
/http/roundtrip.go:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !js !wasm
6 |
7 | package http
8 |
9 | // RoundTrip implements the RoundTripper interface.
10 | //
11 | // For higher-level HTTP client support (such as handling of cookies
12 | // and redirects), see Get, Post, and the Client type.
13 | //
14 | // Like the RoundTripper interface, the error types returned
15 | // by RoundTrip are unspecified.
16 | func (t *Transport) RoundTrip(req *Request) (*Response, error) {
17 | return t.roundTrip(req)
18 | }
19 |
--------------------------------------------------------------------------------
/http/testdata/file:
--------------------------------------------------------------------------------
1 | 0123456789
2 |
--------------------------------------------------------------------------------
/http/testdata/index.html:
--------------------------------------------------------------------------------
1 | index.html says hello
2 |
--------------------------------------------------------------------------------
/http/testdata/style.css:
--------------------------------------------------------------------------------
1 | body {}
2 |
--------------------------------------------------------------------------------
/http/triv.go:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build ignore
6 |
7 | package main
8 |
9 | import (
10 | "bytes"
11 | "expvar"
12 | "flag"
13 | "fmt"
14 | "io"
15 | "log"
16 | "github.com/hunterbdm/hello-requests/http"
17 | "os"
18 | "os/exec"
19 | "strconv"
20 | "sync"
21 | )
22 |
23 | // hello world, the web server
24 | var helloRequests = expvar.NewInt("hello-requests")
25 |
26 | func HelloServer(w http.ResponseWriter, req *http.Request) {
27 | helloRequests.Add(1)
28 | io.WriteString(w, "hello, world!\n")
29 | }
30 |
31 | // Simple counter server. POSTing to it will set the value.
32 | type Counter struct {
33 | mu sync.Mutex // protects n
34 | n int
35 | }
36 |
37 | // This makes Counter satisfy the expvar.Var interface, so we can export
38 | // it directly.
39 | func (ctr *Counter) String() string {
40 | ctr.mu.Lock()
41 | defer ctr.mu.Unlock()
42 | return fmt.Sprintf("%d", ctr.n)
43 | }
44 |
45 | func (ctr *Counter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
46 | ctr.mu.Lock()
47 | defer ctr.mu.Unlock()
48 | switch req.Method {
49 | case "GET":
50 | ctr.n++
51 | case "POST":
52 | buf := new(bytes.Buffer)
53 | io.Copy(buf, req.Body)
54 | body := buf.String()
55 | if n, err := strconv.Atoi(body); err != nil {
56 | fmt.Fprintf(w, "bad POST: %v\nbody: [%v]\n", err, body)
57 | } else {
58 | ctr.n = n
59 | fmt.Fprint(w, "counter reset\n")
60 | }
61 | }
62 | fmt.Fprintf(w, "counter = %d\n", ctr.n)
63 | }
64 |
65 | // simple flag server
66 | var booleanflag = flag.Bool("boolean", true, "another flag for testing")
67 |
68 | func FlagServer(w http.ResponseWriter, req *http.Request) {
69 | w.Header().Set("Content-Type", "text/plain; charset=utf-8")
70 | fmt.Fprint(w, "Flags:\n")
71 | flag.VisitAll(func(f *flag.Flag) {
72 | if f.Value.String() != f.DefValue {
73 | fmt.Fprintf(w, "%s = %s [default = %s]\n", f.Name, f.Value.String(), f.DefValue)
74 | } else {
75 | fmt.Fprintf(w, "%s = %s\n", f.Name, f.Value.String())
76 | }
77 | })
78 | }
79 |
80 | // simple argument server
81 | func ArgServer(w http.ResponseWriter, req *http.Request) {
82 | for _, s := range os.Args {
83 | fmt.Fprint(w, s, " ")
84 | }
85 | }
86 |
87 | // a channel (just for the fun of it)
88 | type Chan chan int
89 |
90 | func ChanCreate() Chan {
91 | c := make(Chan)
92 | go func(c Chan) {
93 | for x := 0; ; x++ {
94 | c <- x
95 | }
96 | }(c)
97 | return c
98 | }
99 |
100 | func (ch Chan) ServeHTTP(w http.ResponseWriter, req *http.Request) {
101 | io.WriteString(w, fmt.Sprintf("channel send #%d\n", <-ch))
102 | }
103 |
104 | // exec a program, redirecting output
105 | func DateServer(rw http.ResponseWriter, req *http.Request) {
106 | rw.Header().Set("Content-Type", "text/plain; charset=utf-8")
107 |
108 | date, err := exec.Command("/bin/date").Output()
109 | if err != nil {
110 | http.Error(rw, err.Error(), http.StatusInternalServerError)
111 | return
112 | }
113 | rw.Write(date)
114 | }
115 |
116 | func Logger(w http.ResponseWriter, req *http.Request) {
117 | log.Print(req.URL)
118 | http.Error(w, "oops", http.StatusNotFound)
119 | }
120 |
121 | var webroot = flag.String("root", os.Getenv("HOME"), "web root directory")
122 |
123 | func main() {
124 | flag.Parse()
125 |
126 | // The counter is published as a variable directly.
127 | ctr := new(Counter)
128 | expvar.Publish("counter", ctr)
129 | http.Handle("/counter", ctr)
130 | http.Handle("/", http.HandlerFunc(Logger))
131 | http.Handle("/go/", http.StripPrefix("/go/", http.FileServer(http.Dir(*webroot))))
132 | http.Handle("/chan", ChanCreate())
133 | http.HandleFunc("/flags", FlagServer)
134 | http.HandleFunc("/args", ArgServer)
135 | http.HandleFunc("/go/hello", HelloServer)
136 | http.HandleFunc("/date", DateServer)
137 | log.Fatal(http.ListenAndServe(":12345", nil))
138 | }
139 |
--------------------------------------------------------------------------------
/internal/nettrace/nettrace.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package nettrace contains internal hooks for tracing activity in
6 | // the net package. This package is purely internal for use by the
7 | // net/http/httptrace package and has no stable API exposed to end
8 | // users.
9 | package nettrace
10 |
11 | // TraceKey is a context.Context Value key. Its associated value should
12 | // be a *Trace struct.
13 | type TraceKey struct{}
14 |
15 | // LookupIPAltResolverKey is a context.Context Value key used by tests to
16 | // specify an alternate resolver func.
17 | // It is not exposed to outsider users. (But see issue 12503)
18 | // The value should be the same type as lookupIP:
19 | // func lookupIP(ctx context.Context, host string) ([]IPAddr, error)
20 | type LookupIPAltResolverKey struct{}
21 |
22 | // Trace contains a set of hooks for tracing events within
23 | // the net package. Any specific hook may be nil.
24 | type Trace struct {
25 | // DNSStart is called with the hostname of a DNS lookup
26 | // before it begins.
27 | DNSStart func(name string)
28 |
29 | // DNSDone is called after a DNS lookup completes (or fails).
30 | // The coalesced parameter is whether singleflight de-dupped
31 | // the call. The addrs are of type net.IPAddr but can't
32 | // actually be for circular dependency reasons.
33 | DNSDone func(netIPs []interface{}, coalesced bool, err error)
34 |
35 | // ConnectStart is called before a Dial, excluding Dials made
36 | // during DNS lookups. In the case of DualStack (Happy Eyeballs)
37 | // dialing, this may be called multiple times, from multiple
38 | // goroutines.
39 | ConnectStart func(network, addr string)
40 |
41 | // ConnectStart is called after a Dial with the results, excluding
42 | // Dials made during DNS lookups. It may also be called multiple
43 | // times, like ConnectStart.
44 | ConnectDone func(network, addr string, err error)
45 | }
46 |
--------------------------------------------------------------------------------
/internal/profile/filter.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Implements methods to filter samples from profiles.
6 |
7 | package profile
8 |
9 | import "regexp"
10 |
11 | // FilterSamplesByName filters the samples in a profile and only keeps
12 | // samples where at least one frame matches focus but none match ignore.
13 | // Returns true is the corresponding regexp matched at least one sample.
14 | func (p *Profile) FilterSamplesByName(focus, ignore, hide *regexp.Regexp) (fm, im, hm bool) {
15 | focusOrIgnore := make(map[uint64]bool)
16 | hidden := make(map[uint64]bool)
17 | for _, l := range p.Location {
18 | if ignore != nil && l.matchesName(ignore) {
19 | im = true
20 | focusOrIgnore[l.ID] = false
21 | } else if focus == nil || l.matchesName(focus) {
22 | fm = true
23 | focusOrIgnore[l.ID] = true
24 | }
25 | if hide != nil && l.matchesName(hide) {
26 | hm = true
27 | l.Line = l.unmatchedLines(hide)
28 | if len(l.Line) == 0 {
29 | hidden[l.ID] = true
30 | }
31 | }
32 | }
33 |
34 | s := make([]*Sample, 0, len(p.Sample))
35 | for _, sample := range p.Sample {
36 | if focusedAndNotIgnored(sample.Location, focusOrIgnore) {
37 | if len(hidden) > 0 {
38 | var locs []*Location
39 | for _, loc := range sample.Location {
40 | if !hidden[loc.ID] {
41 | locs = append(locs, loc)
42 | }
43 | }
44 | if len(locs) == 0 {
45 | // Remove sample with no locations (by not adding it to s).
46 | continue
47 | }
48 | sample.Location = locs
49 | }
50 | s = append(s, sample)
51 | }
52 | }
53 | p.Sample = s
54 |
55 | return
56 | }
57 |
58 | // matchesName reports whether the function name or file in the
59 | // location matches the regular expression.
60 | func (loc *Location) matchesName(re *regexp.Regexp) bool {
61 | for _, ln := range loc.Line {
62 | if fn := ln.Function; fn != nil {
63 | if re.MatchString(fn.Name) {
64 | return true
65 | }
66 | if re.MatchString(fn.Filename) {
67 | return true
68 | }
69 | }
70 | }
71 | return false
72 | }
73 |
74 | // unmatchedLines returns the lines in the location that do not match
75 | // the regular expression.
76 | func (loc *Location) unmatchedLines(re *regexp.Regexp) []Line {
77 | var lines []Line
78 | for _, ln := range loc.Line {
79 | if fn := ln.Function; fn != nil {
80 | if re.MatchString(fn.Name) {
81 | continue
82 | }
83 | if re.MatchString(fn.Filename) {
84 | continue
85 | }
86 | }
87 | lines = append(lines, ln)
88 | }
89 | return lines
90 | }
91 |
92 | // focusedAndNotIgnored looks up a slice of ids against a map of
93 | // focused/ignored locations. The map only contains locations that are
94 | // explicitly focused or ignored. Returns whether there is at least
95 | // one focused location but no ignored locations.
96 | func focusedAndNotIgnored(locs []*Location, m map[uint64]bool) bool {
97 | var f bool
98 | for _, loc := range locs {
99 | if focus, focusOrIgnore := m[loc.ID]; focusOrIgnore {
100 | if focus {
101 | // Found focused location. Must keep searching in case there
102 | // is an ignored one as well.
103 | f = true
104 | } else {
105 | // Found ignored location. Can return false right away.
106 | return false
107 | }
108 | }
109 | }
110 | return f
111 | }
112 |
113 | // TagMatch selects tags for filtering
114 | type TagMatch func(key, val string, nval int64) bool
115 |
116 | // FilterSamplesByTag removes all samples from the profile, except
117 | // those that match focus and do not match the ignore regular
118 | // expression.
119 | func (p *Profile) FilterSamplesByTag(focus, ignore TagMatch) (fm, im bool) {
120 | samples := make([]*Sample, 0, len(p.Sample))
121 | for _, s := range p.Sample {
122 | focused, ignored := focusedSample(s, focus, ignore)
123 | fm = fm || focused
124 | im = im || ignored
125 | if focused && !ignored {
126 | samples = append(samples, s)
127 | }
128 | }
129 | p.Sample = samples
130 | return
131 | }
132 |
133 | // focusedTag checks a sample against focus and ignore regexps.
134 | // Returns whether the focus/ignore regexps match any tags
135 | func focusedSample(s *Sample, focus, ignore TagMatch) (fm, im bool) {
136 | fm = focus == nil
137 | for key, vals := range s.Label {
138 | for _, val := range vals {
139 | if ignore != nil && ignore(key, val, 0) {
140 | im = true
141 | }
142 | if !fm && focus(key, val, 0) {
143 | fm = true
144 | }
145 | }
146 | }
147 | for key, vals := range s.NumLabel {
148 | for _, val := range vals {
149 | if ignore != nil && ignore(key, "", val) {
150 | im = true
151 | }
152 | if !fm && focus(key, "", val) {
153 | fm = true
154 | }
155 | }
156 | }
157 | return fm, im
158 | }
159 |
--------------------------------------------------------------------------------
/internal/profile/profile_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2015 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package profile
6 |
7 | import (
8 | "bytes"
9 | "testing"
10 | )
11 |
12 | func TestEmptyProfile(t *testing.T) {
13 | var buf bytes.Buffer
14 | p, err := Parse(&buf)
15 | if err != nil {
16 | t.Error("Want no error, got", err)
17 | }
18 | if p == nil {
19 | t.Fatal("Want a valid profile, got ")
20 | }
21 | if !p.Empty() {
22 | t.Errorf("Profile should be empty, got %#v", p)
23 | }
24 | }
25 |
26 | func TestParseContention(t *testing.T) {
27 | tests := []struct {
28 | name string
29 | in string
30 | wantErr bool
31 | }{
32 | {
33 | name: "valid",
34 | in: `--- mutex:
35 | cycles/second=3491920901
36 | sampling period=1
37 | 43227965305 1659640 @ 0x45e851 0x45f764 0x4a2be1 0x44ea31
38 | 34035731690 15760 @ 0x45e851 0x45f764 0x4a2b17 0x44ea31
39 | `,
40 | },
41 | {
42 | name: "valid with comment",
43 | in: `--- mutex:
44 | cycles/second=3491920901
45 | sampling period=1
46 | 43227965305 1659640 @ 0x45e851 0x45f764 0x4a2be1 0x44ea31
47 | # 0x45e850 sync.(*Mutex).Unlock+0x80 /go/src/sync/mutex.go:126
48 | # 0x45f763 sync.(*RWMutex).Unlock+0x83 /go/src/sync/rwmutex.go:125
49 | # 0x4a2be0 main.main.func3+0x70 /go/src/internal/pprof/profile/a_binary.go:58
50 |
51 | 34035731690 15760 @ 0x45e851 0x45f764 0x4a2b17 0x44ea31
52 | # 0x45e850 sync.(*Mutex).Unlock+0x80 /go/src/sync/mutex.go:126
53 | # 0x45f763 sync.(*RWMutex).Unlock+0x83 /go/src/sync/rwmutex.go:125
54 | # 0x4a2b16 main.main.func2+0xd6 /go/src/internal/pprof/profile/a_binary.go:48
55 | `,
56 | },
57 | {
58 | name: "empty",
59 | in: `--- mutex:`,
60 | wantErr: true,
61 | },
62 | {
63 | name: "invalid header",
64 | in: `--- channel:
65 | 43227965305 1659640 @ 0x45e851 0x45f764 0x4a2be1 0x44ea31`,
66 | wantErr: true,
67 | },
68 | }
69 | for _, tc := range tests {
70 | _, err := parseContention([]byte(tc.in))
71 | if tc.wantErr && err == nil {
72 | t.Errorf("parseContention(%q) succeeded unexpectedly", tc.name)
73 | }
74 | if !tc.wantErr && err != nil {
75 | t.Errorf("parseContention(%q) failed unexpectedly: %v", tc.name, err)
76 | }
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/internal/profile/proto_test.go:
--------------------------------------------------------------------------------
1 | package profile
2 |
3 | import (
4 | "reflect"
5 | "testing"
6 | )
7 |
8 | func TestPackedEncoding(t *testing.T) {
9 |
10 | type testcase struct {
11 | uint64s []uint64
12 | int64s []int64
13 | encoded []byte
14 | }
15 | for i, tc := range []testcase{
16 | {
17 | []uint64{0, 1, 10, 100, 1000, 10000},
18 | []int64{1000, 0, 1000},
19 | []byte{10, 8, 0, 1, 10, 100, 232, 7, 144, 78, 18, 5, 232, 7, 0, 232, 7},
20 | },
21 | {
22 | []uint64{10000},
23 | nil,
24 | []byte{8, 144, 78},
25 | },
26 | {
27 | nil,
28 | []int64{-10000},
29 | []byte{16, 240, 177, 255, 255, 255, 255, 255, 255, 255, 1},
30 | },
31 | } {
32 | source := &packedInts{tc.uint64s, tc.int64s}
33 | if got, want := marshal(source), tc.encoded; !reflect.DeepEqual(got, want) {
34 | t.Errorf("failed encode %d, got %v, want %v", i, got, want)
35 | }
36 |
37 | dest := new(packedInts)
38 | if err := unmarshal(tc.encoded, dest); err != nil {
39 | t.Errorf("failed decode %d: %v", i, err)
40 | continue
41 | }
42 | if got, want := dest.uint64s, tc.uint64s; !reflect.DeepEqual(got, want) {
43 | t.Errorf("failed decode uint64s %d, got %v, want %v", i, got, want)
44 | }
45 | if got, want := dest.int64s, tc.int64s; !reflect.DeepEqual(got, want) {
46 | t.Errorf("failed decode int64s %d, got %v, want %v", i, got, want)
47 | }
48 | }
49 | }
50 |
51 | type packedInts struct {
52 | uint64s []uint64
53 | int64s []int64
54 | }
55 |
56 | func (u *packedInts) decoder() []decoder {
57 | return []decoder{
58 | nil,
59 | func(b *buffer, m message) error { return decodeUint64s(b, &m.(*packedInts).uint64s) },
60 | func(b *buffer, m message) error { return decodeInt64s(b, &m.(*packedInts).int64s) },
61 | }
62 | }
63 |
64 | func (u *packedInts) encode(b *buffer) {
65 | encodeUint64s(b, 1, u.uint64s)
66 | encodeInt64s(b, 2, u.int64s)
67 | }
68 |
--------------------------------------------------------------------------------
/internal/profile/prune.go:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Implements methods to remove frames from profiles.
6 |
7 | package profile
8 |
9 | import (
10 | "fmt"
11 | "regexp"
12 | )
13 |
14 | // Prune removes all nodes beneath a node matching dropRx, and not
15 | // matching keepRx. If the root node of a Sample matches, the sample
16 | // will have an empty stack.
17 | func (p *Profile) Prune(dropRx, keepRx *regexp.Regexp) {
18 | prune := make(map[uint64]bool)
19 | pruneBeneath := make(map[uint64]bool)
20 |
21 | for _, loc := range p.Location {
22 | var i int
23 | for i = len(loc.Line) - 1; i >= 0; i-- {
24 | if fn := loc.Line[i].Function; fn != nil && fn.Name != "" {
25 | funcName := fn.Name
26 | // Account for leading '.' on the PPC ELF v1 ABI.
27 | if funcName[0] == '.' {
28 | funcName = funcName[1:]
29 | }
30 | if dropRx.MatchString(funcName) {
31 | if keepRx == nil || !keepRx.MatchString(funcName) {
32 | break
33 | }
34 | }
35 | }
36 | }
37 |
38 | if i >= 0 {
39 | // Found matching entry to prune.
40 | pruneBeneath[loc.ID] = true
41 |
42 | // Remove the matching location.
43 | if i == len(loc.Line)-1 {
44 | // Matched the top entry: prune the whole location.
45 | prune[loc.ID] = true
46 | } else {
47 | loc.Line = loc.Line[i+1:]
48 | }
49 | }
50 | }
51 |
52 | // Prune locs from each Sample
53 | for _, sample := range p.Sample {
54 | // Scan from the root to the leaves to find the prune location.
55 | // Do not prune frames before the first user frame, to avoid
56 | // pruning everything.
57 | foundUser := false
58 | for i := len(sample.Location) - 1; i >= 0; i-- {
59 | id := sample.Location[i].ID
60 | if !prune[id] && !pruneBeneath[id] {
61 | foundUser = true
62 | continue
63 | }
64 | if !foundUser {
65 | continue
66 | }
67 | if prune[id] {
68 | sample.Location = sample.Location[i+1:]
69 | break
70 | }
71 | if pruneBeneath[id] {
72 | sample.Location = sample.Location[i:]
73 | break
74 | }
75 | }
76 | }
77 | }
78 |
79 | // RemoveUninteresting prunes and elides profiles using built-in
80 | // tables of uninteresting function names.
81 | func (p *Profile) RemoveUninteresting() error {
82 | var keep, drop *regexp.Regexp
83 | var err error
84 |
85 | if p.DropFrames != "" {
86 | if drop, err = regexp.Compile("^(" + p.DropFrames + ")$"); err != nil {
87 | return fmt.Errorf("failed to compile regexp %s: %v", p.DropFrames, err)
88 | }
89 | if p.KeepFrames != "" {
90 | if keep, err = regexp.Compile("^(" + p.KeepFrames + ")$"); err != nil {
91 | return fmt.Errorf("failed to compile regexp %s: %v", p.KeepFrames, err)
92 | }
93 | }
94 | p.Prune(drop, keep)
95 | }
96 | return nil
97 | }
98 |
--------------------------------------------------------------------------------
/request.go:
--------------------------------------------------------------------------------
1 | package request
2 |
3 | import (
4 | "bytes"
5 | "encoding/base64"
6 | "encoding/json"
7 | "errors"
8 | "github.com/hunterbdm/hello-requests/compress"
9 | "github.com/hunterbdm/hello-requests/http"
10 | "github.com/hunterbdm/hello-requests/http/cookiejar"
11 | "github.com/hunterbdm/hello-requests/utils"
12 | "io/ioutil"
13 | "strings"
14 | "time"
15 | )
16 |
17 | // Features:
18 | //
19 | // - Matching ClientHello fingerprints (done)
20 | // - Matching http/2 fingerprints (done)
21 | // - Matching http/2 header order (done)
22 | // - Custom normal header ordering (done)
23 | // - Trusted certificate checks (done)
24 | // - JSON response parsing (done)
25 | // - JSON body building (done)
26 | // - Custom idle connection timeouts (done)
27 | // - Custom request timeouts (done)
28 | // - Brotli decompression (done)
29 |
30 | // utls additions/fixes:
31 | //
32 | // - PreSharedKey extension support added
33 | // - Fixed the same value being used on both GREASE extensions
34 | // causing "tls: error decoding message"
35 |
36 | // TODO
37 | //
38 | // - Add PSK toggle
39 |
40 | func Do(opts Options) (*Response, error) {
41 | return request(opts, nil)
42 | }
43 |
44 | func Jar() *cookiejar.Jar {
45 | jar, _ := cookiejar.New(nil)
46 | return jar
47 | }
48 |
49 | func base64Decode(message []byte) (b []byte, err error) {
50 | var l int
51 | b = make([]byte, base64.StdEncoding.DecodedLen(len(message)))
52 | l, err = base64.StdEncoding.Decode(b, message)
53 | if err != nil {
54 | return
55 | }
56 | return b[:l], nil
57 | }
58 |
59 | func request(opts Options, previous *Response) (*Response, error) {
60 | if opts.ClientSettings == nil {
61 | opts.ClientSettings = &defaultClientSettings
62 | } else {
63 | opts.ClientSettings.AddDefaults()
64 | }
65 |
66 | // Check for errors in options provided
67 | parsedUrl, err := opts.Validate()
68 | if err != nil {
69 | return nil, err
70 | }
71 |
72 | // Add cookie header from Jar
73 | if opts.Jar != nil {
74 | cookieHeader := ""
75 |
76 | for i, cookie := range opts.Jar.Cookies(parsedUrl) {
77 | if i > 0 {
78 | cookieHeader += " "
79 | }
80 | cookieHeader += cookie.String() + ";"
81 | }
82 |
83 | if cookieHeader != "" {
84 | opts.Headers["Cookie"] = cookieHeader
85 | }
86 | } else {
87 | opts.Jar = Jar()
88 | }
89 |
90 | // Build http.Request to pass into the http.Client
91 | var req *http.Request
92 | if opts.Base64Body {
93 | byteBody, err := base64Decode([]byte(opts.Body))
94 | if err != nil {
95 | return nil, errors.New("bad base64 body")
96 | }
97 |
98 | req, err = http.NewRequest(opts.Method, opts.URL, bytes.NewReader(byteBody))
99 | } else {
100 | req, err = http.NewRequest(opts.Method, opts.URL, strings.NewReader(opts.Body))
101 | }
102 | if err != nil {
103 | return nil, err
104 | }
105 |
106 | for name, value := range opts.Headers {
107 | //req.Header[name] = []string{value}
108 | req.Header.Set(name, value)
109 | }
110 | // Add HeaderOrder onto request to be used later in the h2_bundle
111 | req.HeaderOrder = opts.HeaderOrder
112 |
113 | if req.Header.Get("Host") != "" {
114 | req.Host = req.Header.Get("Host")
115 |
116 | if req.Host != parsedUrl.Host {
117 | opts.ClientSettings.CustomServerName = req.Header.Get("Host")
118 | }
119 | }
120 |
121 | // Pull http.Client with ClientSettings options
122 | httpClient := GetHttpClient(opts.ClientSettings)
123 |
124 | start := time.Now().UnixNano() / int64(time.Millisecond)
125 | resp, err := httpClient.Do(req)
126 | end := time.Now().UnixNano() / int64(time.Millisecond)
127 |
128 | if err != nil {
129 | return nil, err
130 | }
131 |
132 | if resp != nil {
133 | defer resp.Body.Close()
134 | }
135 |
136 | var body string
137 | if bodyBytes, err := ioutil.ReadAll(resp.Body); err != nil {
138 | return nil, err
139 | } else {
140 | end = time.Now().UnixNano() / int64(time.Millisecond)
141 |
142 | if encoding, ok := resp.Header["Content-Encoding"]; ok {
143 | body = compress.Decompress(bodyBytes, encoding[0])
144 | } else {
145 | body = string(bodyBytes)
146 | }
147 | }
148 |
149 | // Add response cookies to jar
150 | opts.Jar.SetCookies(parsedUrl, utils.ReadSetCookies(resp.Header))
151 |
152 | var jsonParsed JSON
153 | if opts.ParseJSONResponse {
154 | _ = json.Unmarshal([]byte(body), &jsonParsed)
155 | } else if contentType, ok := resp.Header["Content-Type"]; ok && strings.Contains(contentType[0], "application/json") {
156 | // Attempt to parse JSON body if response content-type is "application/json"
157 | _ = json.Unmarshal([]byte(body), &jsonParsed)
158 | }
159 |
160 | res := Response{
161 | StatusCode: resp.StatusCode,
162 | Headers: resp.Header,
163 | Body: body,
164 | Json: jsonParsed,
165 | Request: &opts,
166 | Time: int(end - start),
167 | Previous: previous,
168 | }
169 |
170 | // Return redirected response if we are following redirects
171 | loc, ok := res.Headers["Location"]
172 | if opts.FollowRedirects && ok && len(loc) > 0 {
173 | newHeaders := opts.Headers
174 | delete(newHeaders, "content-length")
175 | delete(newHeaders, "Content-Length")
176 | delete(newHeaders, "origin")
177 | delete(newHeaders, "Origin")
178 | delete(newHeaders, "content-type")
179 | delete(newHeaders, "Content-Type")
180 | delete(newHeaders, "host")
181 | delete(newHeaders, "Host")
182 |
183 |
184 | url := loc[0]
185 | // Check if the baseUrl is included in the location header
186 | if strings.Index(url, "/") == 0 {
187 | url = parsedUrl.Scheme + "://" + parsedUrl.Host + url
188 | }
189 |
190 | newOpts := Options{
191 | URL: url,
192 | Headers: newHeaders,
193 | HeaderOrder: opts.HeaderOrder,
194 | Jar: opts.Jar,
195 | ClientSettings: opts.ClientSettings,
196 | FollowRedirects: opts.FollowRedirects,
197 | ParseJSONResponse: opts.ParseJSONResponse,
198 | }
199 |
200 | return request(newOpts, &res)
201 | }
202 |
203 | return &res, nil
204 | }
--------------------------------------------------------------------------------
/types.go:
--------------------------------------------------------------------------------
1 | package request
2 |
3 | import (
4 | "encoding/json"
5 | "errors"
6 | "fmt"
7 | "github.com/hunterbdm/hello-requests/http/cookiejar"
8 | "net/url"
9 | "strconv"
10 | "strings"
11 | )
12 |
13 | type Headers map[string]string
14 |
15 | type HeaderOrder []string
16 |
17 | type JSON map[string]interface{}
18 |
19 | type Options struct {
20 | Method string `json:"Method"`
21 | URL string `json:"URL"`
22 | Headers Headers `json:"Headers"`
23 | HeaderOrder HeaderOrder `json:"HeaderOrder"`
24 | Body string `json:"Body"`
25 | Json JSON `json:"Json"`
26 | Form JSON `json:"Form"`
27 | QS JSON `json:"QS"`
28 | Base64Body bool `json:"Base64Body"`
29 |
30 | Jar *cookiejar.Jar
31 | ClientSettings *ClientSettings `json:"ClientSettings"`
32 |
33 | FollowRedirects bool `json:"FollowRedirects"`
34 |
35 | // true if we should attempt to JSON parse the response, no matter the response "Content-Type" header
36 | ParseJSONResponse bool `json:"ParseJSONResponse"`
37 | }
38 |
39 | type Response struct {
40 | StatusCode int `json:"StatusCode"`
41 | Headers map[string][]string `json:"Headers"`
42 | Body string `json:"Body"`
43 | Json JSON `json:"Json"`
44 | Request *Options `json:"Request"`
45 | Previous *Response `json:"Previous"`
46 | Time int `json:"Time"`
47 | }
48 |
49 | func (o *Options) Validate() (*url.URL, error) {
50 | // Fix Method
51 | if o.Method == "" {
52 | o.Method = "GET"
53 | } else {
54 | o.Method = strings.ToUpper(o.Method)
55 | }
56 |
57 | // Make sure Headers map is not nil
58 | if o.Headers == nil {
59 | o.Headers = Headers{}
60 | }
61 |
62 | // Format all headers in HeaderOrder
63 | //for i, header := range o.HeaderOrder {
64 | // o.HeaderOrder[i] = textproto.CanonicalMIMEHeaderKey(header)
65 | //}
66 |
67 |
68 | // Stringify JSON body if provided
69 | if o.Json != nil {
70 | if o.Body != "" {
71 | return nil, errors.New("cannot provide both 'Body' and 'Json'")
72 | }
73 |
74 | jsonBody, err := json.Marshal(o.Json)
75 |
76 | if err != nil {
77 | return nil, errors.New("invalid JSON body")
78 | }
79 |
80 | o.Body = string(jsonBody)
81 | } else if o.Form != nil {
82 | if o.Body != "" {
83 | return nil, errors.New("cannot provide both 'Body' and 'Form'")
84 | }
85 |
86 | o.Body = o.Form.QSMarshal()
87 | }
88 |
89 | // Validate URL
90 | parsedUrl, err := url.Parse(o.URL)
91 | if err != nil {
92 | return nil, errors.New("invalid URL")
93 | }
94 |
95 | // Add raw query string body to url
96 | if o.QS != nil {
97 | parsedUrl.RawQuery = o.QS.QSMarshal()
98 | o.URL = parsedUrl.String()
99 | }
100 |
101 | return parsedUrl, nil
102 | }
103 |
104 | func (form *JSON) QSMarshal() string {
105 | values := url.Values{}
106 |
107 | for name, val := range *form {
108 | if valFloat64, ok := val.(float64); ok {
109 | values.Add(name, fmt.Sprintf("%g", valFloat64))
110 | } else if valInt, ok := val.(int); ok {
111 | values.Add(name, strconv.Itoa(valInt))
112 | } else {
113 | values.Add(name, val.(string))
114 | }
115 | }
116 |
117 | return values.Encode()
118 | }
--------------------------------------------------------------------------------
/utils/utils.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "errors"
5 | "golang.org/x/net/http/httpguts"
6 | "github.com/hunterbdm/hello-requests/http"
7 | "net/url"
8 | "strconv"
9 | "strings"
10 | "time"
11 | )
12 |
13 | func ParseProxy(p string) (*url.URL, error) {
14 | // Example inputs
15 | // 127.0.0.1:1234
16 | // 127.0.0.1:1234:user:pass
17 | // http://127.0.0.1:1234
18 | // http://user:pass@127.0.0.1:1234
19 |
20 | // Proxy already formatted
21 | if strings.Index(p, "http") == 0 {
22 | return url.Parse(p)
23 | }
24 |
25 | proxySplit := strings.Split(p, ":")
26 |
27 | if len(proxySplit) == 2 {
28 | return url.Parse("http://" + p)
29 | } else if len(proxySplit) == 4 {
30 | return url.Parse("http://" + proxySplit[2] + ":" + proxySplit[3] + "@" + proxySplit[0] + ":" + proxySplit[1])
31 | } else {
32 | return nil, errors.New("invalid proxy format")
33 | }
34 | }
35 |
36 | // Taken from http package
37 | func ReadSetCookies(h http.Header) []*http.Cookie {
38 | cookieCount := len(h["Set-Cookie"])
39 | if cookieCount == 0 {
40 | return []*http.Cookie{}
41 | }
42 | cookies := make([]*http.Cookie, 0, cookieCount)
43 | for _, line := range h["Set-Cookie"] {
44 | parts := strings.Split(strings.TrimSpace(line), ";")
45 | if len(parts) == 1 && parts[0] == "" {
46 | continue
47 | }
48 | parts[0] = strings.TrimSpace(parts[0])
49 | j := strings.Index(parts[0], "=")
50 | if j < 0 {
51 | continue
52 | }
53 | name, value := parts[0][:j], parts[0][j+1:]
54 | if !IsCookieNameValid(name) {
55 | continue
56 | }
57 | value, ok := ParseCookieValue(value, true)
58 | if !ok {
59 | continue
60 | }
61 | c := &http.Cookie{
62 | Name: name,
63 | Value: value,
64 | Raw: line,
65 | }
66 | for i := 1; i < len(parts); i++ {
67 | parts[i] = strings.TrimSpace(parts[i])
68 | if len(parts[i]) == 0 {
69 | continue
70 | }
71 |
72 | attr, val := parts[i], ""
73 | if j := strings.Index(attr, "="); j >= 0 {
74 | attr, val = attr[:j], attr[j+1:]
75 | }
76 | lowerAttr := strings.ToLower(attr)
77 | val, ok = ParseCookieValue(val, false)
78 | if !ok {
79 | c.Unparsed = append(c.Unparsed, parts[i])
80 | continue
81 | }
82 | switch lowerAttr {
83 | case "samesite":
84 | lowerVal := strings.ToLower(val)
85 | switch lowerVal {
86 | case "lax":
87 | c.SameSite = http.SameSiteLaxMode
88 | case "strict":
89 | c.SameSite = http.SameSiteStrictMode
90 | case "none":
91 | c.SameSite = http.SameSiteNoneMode
92 | default:
93 | c.SameSite = http.SameSiteDefaultMode
94 | }
95 | continue
96 | case "secure":
97 | c.Secure = true
98 | continue
99 | case "httponly":
100 | c.HttpOnly = true
101 | continue
102 | case "domain":
103 | c.Domain = val
104 | continue
105 | case "max-age":
106 | secs, err := strconv.Atoi(val)
107 | if err != nil || secs != 0 && val[0] == '0' {
108 | break
109 | }
110 | if secs <= 0 {
111 | secs = -1
112 | }
113 | c.MaxAge = secs
114 | continue
115 | case "expires":
116 | c.RawExpires = val
117 | exptime, err := time.Parse(time.RFC1123, val)
118 | if err != nil {
119 | exptime, err = time.Parse("Mon, 02-Jan-2006 15:04:05 MST", val)
120 | if err != nil {
121 | c.Expires = time.Time{}
122 | break
123 | }
124 | }
125 | c.Expires = exptime.UTC()
126 | continue
127 | case "path":
128 | c.Path = val
129 | continue
130 | }
131 | c.Unparsed = append(c.Unparsed, parts[i])
132 | }
133 | cookies = append(cookies, c)
134 | }
135 | return cookies
136 | }
137 |
138 | // Taken from http package
139 | func IsCookieNameValid(raw string) bool {
140 | if raw == "" {
141 | return false
142 | }
143 | return strings.IndexFunc(raw, isNotToken) < 0
144 | }
145 |
146 | // Taken from http package
147 | func ParseCookieValue(raw string, allowDoubleQuote bool) (string, bool) {
148 | // Strip the quotes, if present.
149 | if allowDoubleQuote && len(raw) > 1 && raw[0] == '"' && raw[len(raw)-1] == '"' {
150 | raw = raw[1 : len(raw)-1]
151 | }
152 | for i := 0; i < len(raw); i++ {
153 | if !validCookieValueByte(raw[i]) {
154 | return "", false
155 | }
156 | }
157 | return raw, true
158 | }
159 |
160 | // Taken from http package
161 | func validCookieValueByte(b byte) bool {
162 | return 0x20 <= b && b < 0x7f && b != '"' && b != ';' && b != '\\'
163 | }
164 |
165 | // Taken from http package
166 | func isNotToken(r rune) bool {
167 | return !httpguts.IsTokenRune(r)
168 | }
--------------------------------------------------------------------------------
/utls/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | go:
4 | - "1.11.x"
5 |
6 | sudo: required
7 | dist: trusty
8 |
9 | install:
10 | - go get -t ./...
11 | - go get golang.org/x/lint/golint
12 | # Install gometalinter
13 | - go get github.com/alecthomas/gometalinter
14 |
15 | script:
16 | - go test -race -v .
17 | - gometalinter --install
18 | - gometalinter --disable-all -E vet -E ineffassign --tests .
19 | - gometalinter --disable-all -E gofmt -E misspell -E goimports --tests u_*
20 |
--------------------------------------------------------------------------------
/utls/alert.go:
--------------------------------------------------------------------------------
1 | // Copyright 2009 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package tls
6 |
7 | import "strconv"
8 |
9 | type alert uint8
10 |
11 | const (
12 | // alert level
13 | alertLevelWarning = 1
14 | alertLevelError = 2
15 | )
16 |
17 | const (
18 | alertCloseNotify alert = 0
19 | alertUnexpectedMessage alert = 10
20 | alertBadRecordMAC alert = 20
21 | alertDecryptionFailed alert = 21
22 | alertRecordOverflow alert = 22
23 | alertDecompressionFailure alert = 30
24 | alertHandshakeFailure alert = 40
25 | alertBadCertificate alert = 42
26 | alertUnsupportedCertificate alert = 43
27 | alertCertificateRevoked alert = 44
28 | alertCertificateExpired alert = 45
29 | alertCertificateUnknown alert = 46
30 | alertIllegalParameter alert = 47
31 | alertUnknownCA alert = 48
32 | alertAccessDenied alert = 49
33 | alertDecodeError alert = 50
34 | alertDecryptError alert = 51
35 | alertProtocolVersion alert = 70
36 | alertInsufficientSecurity alert = 71
37 | alertInternalError alert = 80
38 | alertInappropriateFallback alert = 86
39 | alertUserCanceled alert = 90
40 | alertNoRenegotiation alert = 100
41 | alertMissingExtension alert = 109
42 | alertUnsupportedExtension alert = 110
43 | alertNoApplicationProtocol alert = 120
44 | )
45 |
46 | var alertText = map[alert]string{
47 | alertCloseNotify: "close notify",
48 | alertUnexpectedMessage: "unexpected message",
49 | alertBadRecordMAC: "bad record MAC",
50 | alertDecryptionFailed: "decryption failed",
51 | alertRecordOverflow: "record overflow",
52 | alertDecompressionFailure: "decompression failure",
53 | alertHandshakeFailure: "handshake failure",
54 | alertBadCertificate: "bad certificate",
55 | alertUnsupportedCertificate: "unsupported certificate",
56 | alertCertificateRevoked: "revoked certificate",
57 | alertCertificateExpired: "expired certificate",
58 | alertCertificateUnknown: "unknown certificate",
59 | alertIllegalParameter: "illegal parameter",
60 | alertUnknownCA: "unknown certificate authority",
61 | alertAccessDenied: "access denied",
62 | alertDecodeError: "error decoding message",
63 | alertDecryptError: "error decrypting message",
64 | alertProtocolVersion: "protocol version not supported",
65 | alertInsufficientSecurity: "insufficient security level",
66 | alertInternalError: "internal error",
67 | alertInappropriateFallback: "inappropriate fallback",
68 | alertUserCanceled: "user canceled",
69 | alertNoRenegotiation: "no Renegotiation",
70 | alertMissingExtension: "missing extension",
71 | alertUnsupportedExtension: "unsupported extension",
72 | alertNoApplicationProtocol: "no application protocol",
73 | }
74 |
75 | func (e alert) String() string {
76 | s, ok := alertText[e]
77 | if ok {
78 | return "tls: " + s
79 | }
80 | return "tls: alert(" + strconv.Itoa(int(e)) + ")"
81 | }
82 |
83 | func (e alert) Error() string {
84 | return e.String()
85 | }
86 |
--------------------------------------------------------------------------------
/utls/auth.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package tls
6 |
7 | import (
8 | "crypto"
9 | "crypto/ecdsa"
10 | "crypto/elliptic"
11 | "crypto/rsa"
12 | "encoding/asn1"
13 | "errors"
14 | "fmt"
15 | "hash"
16 | "io"
17 | )
18 |
19 | // pickSignatureAlgorithm selects a signature algorithm that is compatible with
20 | // the given public key and the list of algorithms from the peer and this side.
21 | // The lists of signature algorithms (peerSigAlgs and ourSigAlgs) are ignored
22 | // for tlsVersion < VersionTLS12.
23 | //
24 | // The returned SignatureScheme codepoint is only meaningful for TLS 1.2,
25 | // previous TLS versions have a fixed hash function.
26 | func pickSignatureAlgorithm(pubkey crypto.PublicKey, peerSigAlgs, ourSigAlgs []SignatureScheme, tlsVersion uint16) (sigAlg SignatureScheme, sigType uint8, hashFunc crypto.Hash, err error) {
27 | if tlsVersion < VersionTLS12 || len(peerSigAlgs) == 0 {
28 | // For TLS 1.1 and before, the signature algorithm could not be
29 | // negotiated and the hash is fixed based on the signature type. For TLS
30 | // 1.2, if the client didn't send signature_algorithms extension then we
31 | // can assume that it supports SHA1. See RFC 5246, Section 7.4.1.4.1.
32 | switch pubkey.(type) {
33 | case *rsa.PublicKey:
34 | if tlsVersion < VersionTLS12 {
35 | return 0, signaturePKCS1v15, crypto.MD5SHA1, nil
36 | } else {
37 | return PKCS1WithSHA1, signaturePKCS1v15, crypto.SHA1, nil
38 | }
39 | case *ecdsa.PublicKey:
40 | return ECDSAWithSHA1, signatureECDSA, crypto.SHA1, nil
41 | default:
42 | return 0, 0, 0, fmt.Errorf("tls: unsupported public key: %T", pubkey)
43 | }
44 | }
45 | for _, sigAlg := range peerSigAlgs {
46 | if !isSupportedSignatureAlgorithm(sigAlg, ourSigAlgs) {
47 | continue
48 | }
49 | hashAlg, err := hashFromSignatureScheme(sigAlg)
50 | if err != nil {
51 | panic("tls: supported signature algorithm has an unknown hash function")
52 | }
53 | sigType := signatureFromSignatureScheme(sigAlg)
54 | switch pubkey.(type) {
55 | case *rsa.PublicKey:
56 | if sigType == signaturePKCS1v15 || sigType == signatureRSAPSS {
57 | return sigAlg, sigType, hashAlg, nil
58 | }
59 | case *ecdsa.PublicKey:
60 | if sigType == signatureECDSA {
61 | return sigAlg, sigType, hashAlg, nil
62 | }
63 | default:
64 | return 0, 0, 0, fmt.Errorf("tls: unsupported public key: %T", pubkey)
65 | }
66 | }
67 | return 0, 0, 0, errors.New("tls: peer doesn't support any common signature algorithms")
68 | }
69 |
70 | // verifyHandshakeSignature verifies a signature against pre-hashed handshake
71 | // contents.
72 | func verifyHandshakeSignature(sigType uint8, pubkey crypto.PublicKey, hashFunc crypto.Hash, digest, sig []byte) error {
73 | switch sigType {
74 | case signatureECDSA:
75 | pubKey, ok := pubkey.(*ecdsa.PublicKey)
76 | if !ok {
77 | return errors.New("tls: ECDSA signing requires a ECDSA public key")
78 | }
79 | ecdsaSig := new(ecdsaSignature)
80 | if _, err := asn1.Unmarshal(sig, ecdsaSig); err != nil {
81 | return err
82 | }
83 | if ecdsaSig.R.Sign() <= 0 || ecdsaSig.S.Sign() <= 0 {
84 | return errors.New("tls: ECDSA signature contained zero or negative values")
85 | }
86 | if !ecdsa.Verify(pubKey, digest, ecdsaSig.R, ecdsaSig.S) {
87 | return errors.New("tls: ECDSA verification failure")
88 | }
89 | case signaturePKCS1v15:
90 | pubKey, ok := pubkey.(*rsa.PublicKey)
91 | if !ok {
92 | return errors.New("tls: RSA signing requires a RSA public key")
93 | }
94 | if err := rsa.VerifyPKCS1v15(pubKey, hashFunc, digest, sig); err != nil {
95 | return err
96 | }
97 | case signatureRSAPSS:
98 | pubKey, ok := pubkey.(*rsa.PublicKey)
99 | if !ok {
100 | return errors.New("tls: RSA signing requires a RSA public key")
101 | }
102 | signOpts := &rsa.PSSOptions{SaltLength: rsa.PSSSaltLengthEqualsHash}
103 | if err := rsa.VerifyPSS(pubKey, hashFunc, digest, sig, signOpts); err != nil {
104 | return err
105 | }
106 | default:
107 | return errors.New("tls: unknown signature algorithm")
108 | }
109 | return nil
110 | }
111 |
112 | const (
113 | serverSignatureContext = "TLS 1.3, server CertificateVerify\x00"
114 | clientSignatureContext = "TLS 1.3, client CertificateVerify\x00"
115 | )
116 |
117 | var signaturePadding = []byte{
118 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
119 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
120 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
121 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
122 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
123 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
124 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
125 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
126 | }
127 |
128 | // writeSignedMessage writes the content to be signed by certificate keys in TLS
129 | // 1.3 to sigHash. See RFC 8446, Section 4.4.3.
130 | func writeSignedMessage(sigHash io.Writer, context string, transcript hash.Hash) {
131 | sigHash.Write(signaturePadding)
132 | io.WriteString(sigHash, context)
133 | sigHash.Write(transcript.Sum(nil))
134 | }
135 |
136 | // signatureSchemesForCertificate returns the list of supported SignatureSchemes
137 | // for a given certificate, based on the public key.
138 | func signatureSchemesForCertificate(cert *Certificate) []SignatureScheme {
139 | priv, ok := cert.PrivateKey.(crypto.Signer)
140 | if !ok {
141 | return nil
142 | }
143 |
144 | switch priv := priv.Public().(type) {
145 | case *ecdsa.PublicKey:
146 | switch priv.Curve {
147 | case elliptic.P256():
148 | return []SignatureScheme{ECDSAWithP256AndSHA256}
149 | case elliptic.P384():
150 | return []SignatureScheme{ECDSAWithP384AndSHA384}
151 | case elliptic.P521():
152 | return []SignatureScheme{ECDSAWithP521AndSHA512}
153 | default:
154 | return nil
155 | }
156 | case *rsa.PublicKey:
157 | // RSA keys with RSA-PSS OID are not supported by crypto/x509.
158 | return []SignatureScheme{
159 | PSSWithSHA256,
160 | PSSWithSHA384,
161 | PSSWithSHA512,
162 | }
163 | default:
164 | return nil
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/utls/cpu/cpu.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // Package cpu implements processor feature detection
6 | // used by the Go standard library.
7 | package cpu
8 |
9 | var X86 x86
10 |
11 | // The booleans in x86 contain the correspondingly named cpuid feature bit.
12 | // HasAVX and HasAVX2 are only set if the OS does support XMM and YMM registers
13 | // in addition to the cpuid feature bit being set.
14 | // The struct is padded to avoid false sharing.
15 | type x86 struct {
16 | _ [CacheLineSize]byte
17 | HasAES bool
18 | HasADX bool
19 | HasAVX bool
20 | HasAVX2 bool
21 | HasBMI1 bool
22 | HasBMI2 bool
23 | HasERMS bool
24 | HasFMA bool
25 | HasOSXSAVE bool
26 | HasPCLMULQDQ bool
27 | HasPOPCNT bool
28 | HasSSE2 bool
29 | HasSSE3 bool
30 | HasSSSE3 bool
31 | HasSSE41 bool
32 | HasSSE42 bool
33 | _ [CacheLineSize]byte
34 | }
35 |
36 | var PPC64 ppc64
37 |
38 | // For ppc64x, it is safe to check only for ISA level starting on ISA v3.00,
39 | // since there are no optional categories. There are some exceptions that also
40 | // require kernel support to work (darn, scv), so there are capability bits for
41 | // those as well. The minimum processor requirement is POWER8 (ISA 2.07), so we
42 | // maintain some of the old capability checks for optional categories for
43 | // safety.
44 | // The struct is padded to avoid false sharing.
45 | type ppc64 struct {
46 | _ [CacheLineSize]byte
47 | HasVMX bool // Vector unit (Altivec)
48 | HasDFP bool // Decimal Floating Point unit
49 | HasVSX bool // Vector-scalar unit
50 | HasHTM bool // Hardware Transactional Memory
51 | HasISEL bool // Integer select
52 | HasVCRYPTO bool // Vector cryptography
53 | HasHTMNOSC bool // HTM: kernel-aborted transaction in syscalls
54 | HasDARN bool // Hardware random number generator (requires kernel enablement)
55 | HasSCV bool // Syscall vectored (requires kernel enablement)
56 | IsPOWER8 bool // ISA v2.07 (POWER8)
57 | IsPOWER9 bool // ISA v3.00 (POWER9)
58 | _ [CacheLineSize]byte
59 | }
60 |
61 | var ARM64 arm64
62 |
63 | // The booleans in arm64 contain the correspondingly named cpu feature bit.
64 | // The struct is padded to avoid false sharing.
65 | type arm64 struct {
66 | _ [CacheLineSize]byte
67 | HasFP bool
68 | HasASIMD bool
69 | HasEVTSTRM bool
70 | HasAES bool
71 | HasPMULL bool
72 | HasSHA1 bool
73 | HasSHA2 bool
74 | HasCRC32 bool
75 | HasATOMICS bool
76 | _ [CacheLineSize]byte
77 | }
78 |
--------------------------------------------------------------------------------
/utls/cpu/cpu_arm.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package cpu
6 |
7 | const CacheLineSize = 32
8 |
--------------------------------------------------------------------------------
/utls/cpu/cpu_arm64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build arm64
6 |
7 | package cpu
8 |
9 | const CacheLineSize = 64
10 |
11 | // arm64 doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2.
12 | // These are linknamed in runtime/os_linux_arm64.go and are initialized by
13 | // archauxv().
14 | var arm64_hwcap uint
15 | var arm64_hwcap2 uint
16 |
17 | // HWCAP/HWCAP2 bits. These are exposed by Linux.
18 | const (
19 | _ARM64_FEATURE_HAS_FP = (1 << 0)
20 | _ARM64_FEATURE_HAS_ASIMD = (1 << 1)
21 | _ARM64_FEATURE_HAS_EVTSTRM = (1 << 2)
22 | _ARM64_FEATURE_HAS_AES = (1 << 3)
23 | _ARM64_FEATURE_HAS_PMULL = (1 << 4)
24 | _ARM64_FEATURE_HAS_SHA1 = (1 << 5)
25 | _ARM64_FEATURE_HAS_SHA2 = (1 << 6)
26 | _ARM64_FEATURE_HAS_CRC32 = (1 << 7)
27 | _ARM64_FEATURE_HAS_ATOMICS = (1 << 8)
28 | )
29 |
30 | func init() {
31 | // HWCAP feature bits
32 | ARM64.HasFP = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_FP)
33 | ARM64.HasASIMD = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_ASIMD)
34 | ARM64.HasEVTSTRM = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_EVTSTRM)
35 | ARM64.HasAES = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_AES)
36 | ARM64.HasPMULL = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_PMULL)
37 | ARM64.HasSHA1 = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_SHA1)
38 | ARM64.HasSHA2 = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_SHA2)
39 | ARM64.HasCRC32 = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_CRC32)
40 | ARM64.HasATOMICS = isSet(arm64_hwcap, _ARM64_FEATURE_HAS_ATOMICS)
41 | }
42 |
43 | func isSet(hwc uint, value uint) bool {
44 | return hwc&value != 0
45 | }
46 |
--------------------------------------------------------------------------------
/utls/cpu/cpu_mips.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package cpu
6 |
7 | const CacheLineSize = 32
8 |
--------------------------------------------------------------------------------
/utls/cpu/cpu_mips64.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package cpu
6 |
7 | const CacheLineSize = 32
8 |
--------------------------------------------------------------------------------
/utls/cpu/cpu_mips64le.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package cpu
6 |
7 | const CacheLineSize = 32
8 |
--------------------------------------------------------------------------------
/utls/cpu/cpu_mipsle.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package cpu
6 |
7 | const CacheLineSize = 32
8 |
--------------------------------------------------------------------------------
/utls/cpu/cpu_ppc64x.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build ppc64 ppc64le
6 |
7 | package cpu
8 |
9 | const CacheLineSize = 128
10 |
11 | // ppc64x doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2.
12 | // These are linknamed in runtime/os_linux_ppc64x.go and are initialized by
13 | // archauxv().
14 | var ppc64x_hwcap uint
15 | var ppc64x_hwcap2 uint
16 |
17 | // HWCAP/HWCAP2 bits. These are exposed by the kernel.
18 | const (
19 | // ISA Level
20 | _PPC_FEATURE2_ARCH_2_07 = 0x80000000
21 | _PPC_FEATURE2_ARCH_3_00 = 0x00800000
22 |
23 | // CPU features
24 | _PPC_FEATURE_HAS_ALTIVEC = 0x10000000
25 | _PPC_FEATURE_HAS_DFP = 0x00000400
26 | _PPC_FEATURE_HAS_VSX = 0x00000080
27 | _PPC_FEATURE2_HAS_HTM = 0x40000000
28 | _PPC_FEATURE2_HAS_ISEL = 0x08000000
29 | _PPC_FEATURE2_HAS_VEC_CRYPTO = 0x02000000
30 | _PPC_FEATURE2_HTM_NOSC = 0x01000000
31 | _PPC_FEATURE2_DARN = 0x00200000
32 | _PPC_FEATURE2_SCV = 0x00100000
33 | )
34 |
35 | func init() {
36 | // HWCAP feature bits
37 | PPC64.HasVMX = isSet(ppc64x_hwcap, _PPC_FEATURE_HAS_ALTIVEC)
38 | PPC64.HasDFP = isSet(ppc64x_hwcap, _PPC_FEATURE_HAS_DFP)
39 | PPC64.HasVSX = isSet(ppc64x_hwcap, _PPC_FEATURE_HAS_VSX)
40 |
41 | // HWCAP2 feature bits
42 | PPC64.IsPOWER8 = isSet(ppc64x_hwcap2, _PPC_FEATURE2_ARCH_2_07)
43 | PPC64.HasHTM = isSet(ppc64x_hwcap2, _PPC_FEATURE2_HAS_HTM)
44 | PPC64.HasISEL = isSet(ppc64x_hwcap2, _PPC_FEATURE2_HAS_ISEL)
45 | PPC64.HasVCRYPTO = isSet(ppc64x_hwcap2, _PPC_FEATURE2_HAS_VEC_CRYPTO)
46 | PPC64.HasHTMNOSC = isSet(ppc64x_hwcap2, _PPC_FEATURE2_HTM_NOSC)
47 | PPC64.IsPOWER9 = isSet(ppc64x_hwcap2, _PPC_FEATURE2_ARCH_3_00)
48 | PPC64.HasDARN = isSet(ppc64x_hwcap2, _PPC_FEATURE2_DARN)
49 | PPC64.HasSCV = isSet(ppc64x_hwcap2, _PPC_FEATURE2_SCV)
50 | }
51 |
52 | func isSet(hwc uint, value uint) bool {
53 | return hwc&value != 0
54 | }
55 |
--------------------------------------------------------------------------------
/utls/cpu/cpu_s390x.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package cpu
6 |
7 | const CacheLineSize = 256
8 |
--------------------------------------------------------------------------------
/utls/cpu/cpu_test.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package cpu_test
6 |
7 | import (
8 | "runtime"
9 | "testing"
10 |
11 | "github.com/hunterbdm/hello-requests/utls/cpu"
12 | )
13 |
14 | func TestAMD64minimalFeatures(t *testing.T) {
15 | if runtime.GOARCH == "amd64" {
16 | if !cpu.X86.HasSSE2 {
17 | t.Fatalf("HasSSE2 expected true, got false")
18 | }
19 | }
20 | }
21 |
22 | func TestAVX2hasAVX(t *testing.T) {
23 | if runtime.GOARCH == "amd64" {
24 | if cpu.X86.HasAVX2 && !cpu.X86.HasAVX {
25 | t.Fatalf("HasAVX expected true, got false")
26 | }
27 | }
28 | }
29 |
30 | func TestPPC64minimalFeatures(t *testing.T) {
31 | if runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" {
32 | if !cpu.PPC64.IsPOWER8 {
33 | t.Fatalf("IsPOWER8 expected true, got false")
34 | }
35 | if !cpu.PPC64.HasVMX {
36 | t.Fatalf("HasVMX expected true, got false")
37 | }
38 | if !cpu.PPC64.HasDFP {
39 | t.Fatalf("HasDFP expected true, got false")
40 | }
41 | if !cpu.PPC64.HasVSX {
42 | t.Fatalf("HasVSX expected true, got false")
43 | }
44 | if !cpu.PPC64.HasISEL {
45 | t.Fatalf("HasISEL expected true, got false")
46 | }
47 | if !cpu.PPC64.HasVCRYPTO {
48 | t.Fatalf("HasVCRYPTO expected true, got false")
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/utls/cpu/cpu_x86.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build 386 amd64 amd64p32
6 |
7 | package cpu
8 |
9 | const CacheLineSize = 64
10 |
11 | // cpuid is implemented in cpu_x86.s.
12 | func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
13 |
14 | // xgetbv with ecx = 0 is implemented in cpu_x86.s.
15 | func xgetbv() (eax, edx uint32)
16 |
17 | func init() {
18 | maxID, _, _, _ := cpuid(0, 0)
19 |
20 | if maxID < 1 {
21 | return
22 | }
23 |
24 | _, _, ecx1, edx1 := cpuid(1, 0)
25 | X86.HasSSE2 = isSet(26, edx1)
26 |
27 | X86.HasSSE3 = isSet(0, ecx1)
28 | X86.HasPCLMULQDQ = isSet(1, ecx1)
29 | X86.HasSSSE3 = isSet(9, ecx1)
30 | X86.HasFMA = isSet(12, ecx1)
31 | X86.HasSSE41 = isSet(19, ecx1)
32 | X86.HasSSE42 = isSet(20, ecx1)
33 | X86.HasPOPCNT = isSet(23, ecx1)
34 | X86.HasAES = isSet(25, ecx1)
35 | X86.HasOSXSAVE = isSet(27, ecx1)
36 |
37 | osSupportsAVX := false
38 | // For XGETBV, OSXSAVE bit is required and sufficient.
39 | if X86.HasOSXSAVE {
40 | eax, _ := xgetbv()
41 | // Check if XMM and YMM registers have OS support.
42 | osSupportsAVX = isSet(1, eax) && isSet(2, eax)
43 | }
44 |
45 | X86.HasAVX = isSet(28, ecx1) && osSupportsAVX
46 |
47 | if maxID < 7 {
48 | return
49 | }
50 |
51 | _, ebx7, _, _ := cpuid(7, 0)
52 | X86.HasBMI1 = isSet(3, ebx7)
53 | X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX
54 | X86.HasBMI2 = isSet(8, ebx7)
55 | X86.HasERMS = isSet(9, ebx7)
56 | X86.HasADX = isSet(19, ebx7)
57 | }
58 |
59 | func isSet(bitpos uint, value uint32) bool {
60 | return value&(1< response:\n%+s\n", dumpResponseNoBody(response))
88 |
89 | return nil
90 | }
91 |
92 | func establishUTLSConn(config *tls.Config, fingerprint tls.ClientHelloID) (*tls.UConn, error) {
93 |
94 | // Establish TCP Connection
95 | dialConn, err := net.DialTimeout("tcp", requestAddr, dialTimeout)
96 | if err != nil {
97 | return nil, fmt.Errorf("net.DialTimeout error: %+v", err)
98 | }
99 |
100 | // Establish the TLS connection.
101 | conn := tls.UClient(dialConn, config, fingerprint)
102 | err = conn.Handshake()
103 | if err != nil {
104 | dialConn.Close()
105 | return nil, fmt.Errorf("uTlsConn.Handshake() error: %+v", err)
106 | }
107 |
108 | return conn, nil
109 | }
110 |
111 | func httpGetOverConn(conn net.Conn, alpn string) (*http.Response, error) {
112 | req := &http.Request{
113 | Method: "GET",
114 | URL: &url.URL{Host: requestHostname + "/"},
115 | Header: make(http.Header),
116 | Host: requestHostname,
117 | }
118 |
119 | req.Header.Add("authority", "www.yeezysupply.com")
120 | req.Header.Add("cache-control", "max-age=0")
121 | req.Header.Add("dnt", "1")
122 | req.Header.Add("upgrade-insecure-requests", "1")
123 | req.Header.Add("user-agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36")
124 | req.Header.Add("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9")
125 | req.Header.Add("sec-fetch-site", "same-origin")
126 | req.Header.Add("sec-fetch-mode", "navigate")
127 | req.Header.Add("sec-fetch-user", "?1")
128 | req.Header.Add("sec-fetch-dest", "document")
129 | req.Header.Add("accept-language", "en-US,en;q=0.9")
130 |
131 | // req.Header.Add("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36")
132 |
133 | alpn = "h2"
134 | switch alpn {
135 | case "h2":
136 | req.Proto = "HTTP/2.0"
137 | req.ProtoMajor = 2
138 | req.ProtoMinor = 0
139 |
140 | tr := http2.Transport{}
141 | cConn, err := tr.NewClientConn(conn)
142 | if err != nil {
143 | return nil, err
144 | }
145 | return cConn.RoundTrip(req)
146 | case "http/1.1", "":
147 | req.Proto = "HTTP/1.1"
148 | req.ProtoMajor = 1
149 | req.ProtoMinor = 1
150 |
151 | err := req.Write(os.Stdout)
152 | if err != nil {
153 | return nil, err
154 | }
155 |
156 | err = req.Write(conn)
157 | if err != nil {
158 | return nil, err
159 | }
160 |
161 | conn.SetReadDeadline(time.Now().Add(time.Duration(10) * time.Second))
162 |
163 | buf, err := ioutil.ReadAll(conn)
164 | fmt.Printf("#> Received %d:\n%+v\n%s\n", len(buf), buf, buf)
165 |
166 | if err != nil {
167 | return nil, fmt.Errorf("failed to call cli.Read: %v", err)
168 | }
169 |
170 | fmt.Printf("HERE\n")
171 | return http.ReadResponse(bufio.NewReader(conn), req)
172 | default:
173 | return nil, fmt.Errorf("unsupported ALPN: %v", alpn)
174 | }
175 | }
176 |
177 | func dumpResponseNoBody(response *http.Response) string {
178 | resp, err := httputil.DumpResponse(response, false)
179 | if err != nil {
180 | return fmt.Sprintf("failed to dump response: %v", err)
181 | }
182 | return string(resp)
183 | }
184 |
--------------------------------------------------------------------------------
/utls/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hunterbdm/hello-requests/6cf3b8e8ad75a7c378e18a3137f707877f881b58/utls/logo.png
--------------------------------------------------------------------------------
/utls/logo_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hunterbdm/hello-requests/6cf3b8e8ad75a7c378e18a3137f707877f881b58/utls/logo_small.png
--------------------------------------------------------------------------------
/utls/testdata/Client-TLSv12-UTLS-AES128-GCM-SHA256-Firefox-55:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hunterbdm/hello-requests/6cf3b8e8ad75a7c378e18a3137f707877f881b58/utls/testdata/Client-TLSv12-UTLS-AES128-GCM-SHA256-Firefox-55
--------------------------------------------------------------------------------
/utls/testdata/Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-GCM-SHA256-Chrome-58:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hunterbdm/hello-requests/6cf3b8e8ad75a7c378e18a3137f707877f881b58/utls/testdata/Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-GCM-SHA256-Chrome-58
--------------------------------------------------------------------------------
/utls/testdata/Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-GCM-SHA256-Chrome-58setclienthello:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hunterbdm/hello-requests/6cf3b8e8ad75a7c378e18a3137f707877f881b58/utls/testdata/Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-GCM-SHA256-Chrome-58setclienthello
--------------------------------------------------------------------------------
/utls/testdata/Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-GCM-SHA256-Chrome-70:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hunterbdm/hello-requests/6cf3b8e8ad75a7c378e18a3137f707877f881b58/utls/testdata/Client-TLSv12-UTLS-ECDHE-ECDSA-AES128-GCM-SHA256-Chrome-70
--------------------------------------------------------------------------------
/utls/testdata/Client-TLSv12-UTLS-ECDHE-ECDSA-AES256-GCM-SHA256-Chrome-70:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hunterbdm/hello-requests/6cf3b8e8ad75a7c378e18a3137f707877f881b58/utls/testdata/Client-TLSv12-UTLS-ECDHE-ECDSA-AES256-GCM-SHA256-Chrome-70
--------------------------------------------------------------------------------
/utls/testdata/Server-SSLv3-RSA-3DES:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 00 00 2f 01 00 00 2b 03 00 6b 1d 6c 38 1a |..../...+..k.l8.|
3 | 00000010 50 71 9a 32 88 4f 4a fe 47 00 8f 2a 58 08 72 cf |Pq.2.OJ.G..*X.r.|
4 | 00000020 b5 f8 27 9d f9 17 76 32 8a 3b 29 00 00 04 00 0a |..'...v2.;).....|
5 | 00000030 00 ff 01 00 |....|
6 | >>> Flow 2 (server to client)
7 | 00000000 16 03 00 00 31 02 00 00 2d 03 00 00 00 00 00 00 |....1...-.......|
8 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
9 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 0a 00 00 |...DOWNGRD......|
10 | 00000030 05 ff 01 00 01 00 16 03 00 02 59 0b 00 02 55 00 |..........Y...U.|
11 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
12 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
13 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
14 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
15 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
16 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
17 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
18 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
19 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
20 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
21 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
22 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
23 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
24 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
25 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
26 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
27 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
28 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
29 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
30 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
31 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
32 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
33 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
34 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
35 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
36 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
37 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
38 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
39 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
40 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
41 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
42 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
43 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
44 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
45 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
46 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
47 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
48 | 00000290 3b e9 fa e7 16 03 00 00 04 0e 00 00 00 |;............|
49 | >>> Flow 3 (client to server)
50 | 00000000 16 03 00 00 84 10 00 00 80 24 e4 7a 2a e8 1b 68 |.........$.z*..h|
51 | 00000010 c5 87 ac 26 72 70 76 c6 3a 2c 9d ed ff 63 3c 5b |...&rpv.:,...c<[|
52 | 00000020 97 17 3e d4 e9 ab 5b f1 30 ed 29 07 1a 6b 69 f6 |..>...[.0.)..ki.|
53 | 00000030 65 b1 c7 b9 15 9f b1 69 7d 74 c4 73 04 2a 45 77 |e......i}t.s.*Ew|
54 | 00000040 ba f7 8f 98 65 ed 19 2d a4 de 74 1e 4e 96 78 11 |....e..-..t.N.x.|
55 | 00000050 33 9f be a5 20 e4 bd a8 a4 1a 4d 02 e7 7a ac 01 |3... .....M..z..|
56 | 00000060 f4 12 01 8d 51 9a 52 26 ac a4 f6 52 fc cf 91 97 |....Q.R&...R....|
57 | 00000070 b5 d7 9f 25 92 b4 16 c4 33 46 bd 41 27 89 a2 72 |...%....3F.A'..r|
58 | 00000080 7b 50 d3 ed b3 29 17 aa ab 14 03 00 00 01 01 16 |{P...)..........|
59 | 00000090 03 00 00 40 ba 01 09 10 84 68 0c 97 25 b5 2d ef |...@.....h..%.-.|
60 | 000000a0 be c6 d9 21 85 fe bf ef d4 f3 24 2f 79 04 fd e6 |...!......$/y...|
61 | 000000b0 d3 c1 d2 1b a9 94 10 2e 1f dd dd 1f 97 de 63 e9 |..............c.|
62 | 000000c0 8f 8a c1 d0 ac e1 69 de 92 fa 16 10 2c 9e 5f 3a |......i.....,._:|
63 | 000000d0 45 7c 3f 88 |E|?.|
64 | >>> Flow 4 (server to client)
65 | 00000000 14 03 00 00 01 01 16 03 00 00 40 3b 60 e6 62 bc |..........@;`.b.|
66 | 00000010 53 0f 95 32 d8 95 33 1b 29 78 49 fd 1f a9 bf 64 |S..2..3.)xI....d|
67 | 00000020 71 2d b5 3e 03 80 a0 06 7a ca cd f6 f3 45 e9 d9 |q-.>....z....E..|
68 | 00000030 c1 fc da 4f 5d 77 a3 07 82 89 3b 77 00 9a 99 a2 |...O]w....;w....|
69 | 00000040 ac bf 73 78 31 a9 8c bf eb d1 2c 17 03 00 00 18 |..sx1.....,.....|
70 | 00000050 e9 c8 b2 91 db fa 9f 3c d4 ed 7d 43 f6 b3 53 d2 |.......<..}C..S.|
71 | 00000060 46 12 d2 6c a5 50 bd e1 17 03 00 00 28 2e 6f 91 |F..l.P......(.o.|
72 | 00000070 21 18 89 7b 94 3d c0 6f 8a 4c b4 95 44 4c fe 1a |!..{.=.o.L..DL..|
73 | 00000080 78 f5 6a fd 8f d0 79 c0 12 2f 4c 12 c4 29 9a 88 |x.j...y../L..)..|
74 | 00000090 43 1c b7 93 3a 15 03 00 00 18 ae 35 00 1f 79 99 |C...:......5..y.|
75 | 000000a0 cd 9f b1 16 a8 0f d6 28 29 e2 0a 16 e2 c2 de b3 |.......().......|
76 | 000000b0 5c 41 |\A|
77 |
--------------------------------------------------------------------------------
/utls/testdata/Server-SSLv3-RSA-AES:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 00 00 2f 01 00 00 2b 03 00 c0 74 e5 6f 1e |..../...+...t.o.|
3 | 00000010 3d 51 26 e2 34 31 68 10 ee 99 ca 45 0f 7d d6 7d |=Q&.41h....E.}.}|
4 | 00000020 29 82 15 23 3f af d1 48 36 1f ac 00 00 04 00 2f |)..#?..H6....../|
5 | 00000030 00 ff 01 00 |....|
6 | >>> Flow 2 (server to client)
7 | 00000000 16 03 00 00 31 02 00 00 2d 03 00 00 00 00 00 00 |....1...-.......|
8 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
9 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 2f 00 00 |...DOWNGRD.../..|
10 | 00000030 05 ff 01 00 01 00 16 03 00 02 59 0b 00 02 55 00 |..........Y...U.|
11 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
12 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
13 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
14 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
15 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
16 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
17 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
18 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
19 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
20 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
21 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
22 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
23 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
24 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
25 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
26 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
27 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
28 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
29 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
30 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
31 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
32 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
33 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
34 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
35 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
36 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
37 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
38 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
39 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
40 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
41 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
42 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
43 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
44 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
45 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
46 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
47 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
48 | 00000290 3b e9 fa e7 16 03 00 00 04 0e 00 00 00 |;............|
49 | >>> Flow 3 (client to server)
50 | 00000000 16 03 00 00 84 10 00 00 80 62 6a 6e 2e 83 74 fe |.........bjn..t.|
51 | 00000010 08 7b e3 38 de be 06 18 ed c3 aa e0 27 5e bb 5d |.{.8........'^.]|
52 | 00000020 a3 22 38 92 d4 94 ec 18 02 f1 fd 57 98 ac 84 3c |."8........W...<|
53 | 00000030 07 ef c9 e2 c4 05 03 9c 89 69 dd cb 47 7c 61 5c |.........i..G|a\|
54 | 00000040 7b c7 02 7b e4 4c 94 28 ea d7 34 ed 03 ef eb de |{..{.L.(..4.....|
55 | 00000050 c0 75 e3 75 46 24 8a ed 33 33 5c 19 65 a2 f8 0c |.u.uF$..33\.e...|
56 | 00000060 69 f9 ce 3e b6 88 e3 f4 2a ba 5c 0d 85 2f 64 88 |i..>....*.\../d.|
57 | 00000070 cb 0e af 03 58 1b 54 71 21 fb 4c 13 ff 67 dd e9 |....X.Tq!.L..g..|
58 | 00000080 1a 83 08 a9 ad 46 85 2b 95 14 03 00 00 01 01 16 |.....F.+........|
59 | 00000090 03 00 00 40 65 17 83 78 12 b1 50 a8 7e 91 ad cf |...@e..x..P.~...|
60 | 000000a0 ff da 1b c3 c2 62 d7 7b dc 85 6a 1e 64 65 2e fc |.....b.{..j.de..|
61 | 000000b0 71 ea bd 4b a6 61 e3 95 27 78 f5 93 e6 6e 4c 83 |q..K.a..'x...nL.|
62 | 000000c0 78 f4 a0 ac 3b 23 08 61 b5 b6 96 3f a5 fd 50 be |x...;#.a...?..P.|
63 | 000000d0 20 ef 8f af | ...|
64 | >>> Flow 4 (server to client)
65 | 00000000 14 03 00 00 01 01 16 03 00 00 40 c1 63 5c 1e 81 |..........@.c\..|
66 | 00000010 ef 1c 55 e7 5b ee 19 2b 89 c9 19 7a 53 96 ae f6 |..U.[..+...zS...|
67 | 00000020 47 22 4b b2 b9 64 38 06 99 b1 58 39 bc c2 7f 1c |G"K..d8...X9....|
68 | 00000030 c4 8e 0a ec f2 3d 41 ac a9 a2 34 d9 a2 66 4e 35 |.....=A...4..fN5|
69 | 00000040 a1 a5 a5 ad 70 c2 62 67 f7 83 3f 17 03 00 00 20 |....p.bg..?.... |
70 | 00000050 bf 4b 66 00 de 5f 75 f1 57 a1 47 e3 35 cb 1a 1b |.Kf.._u.W.G.5...|
71 | 00000060 1e f4 3b f5 96 84 bc ed 36 74 8a 8b 62 46 94 fd |..;.....6t..bF..|
72 | 00000070 17 03 00 00 30 a2 a7 8c ac 1b 27 d7 1a 6a 2b 37 |....0.....'..j+7|
73 | 00000080 cc 76 03 e3 93 6e ee 3d 12 d5 cd d7 b2 fc 59 ae |.v...n.=......Y.|
74 | 00000090 a5 e5 d5 9d 61 86 0b bf 2c 61 de ef 38 95 de 0c |....a...,a..8...|
75 | 000000a0 01 80 15 04 71 15 03 00 00 20 85 70 23 62 cb 0a |....q.... .p#b..|
76 | 000000b0 e0 fd f4 36 a6 7d 1a 85 50 36 70 c1 77 85 0d 94 |...6.}..P6p.w...|
77 | 000000c0 fd 90 8a eb cd ce a4 b5 d8 fc |..........|
78 |
--------------------------------------------------------------------------------
/utls/testdata/Server-SSLv3-RSA-RC4:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 00 00 2f 01 00 00 2b 03 00 d6 26 87 86 f3 |..../...+...&...|
3 | 00000010 3f e3 08 85 7a fc 3c fe 91 44 1a 68 9f c8 77 10 |?...z.<..D.h..w.|
4 | 00000020 5e af fa b9 e1 09 5f fb fa ad dd 00 00 04 00 05 |^....._.........|
5 | 00000030 00 ff 01 00 |....|
6 | >>> Flow 2 (server to client)
7 | 00000000 16 03 00 00 31 02 00 00 2d 03 00 00 00 00 00 00 |....1...-.......|
8 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
9 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 05 00 00 |...DOWNGRD......|
10 | 00000030 05 ff 01 00 01 00 16 03 00 02 59 0b 00 02 55 00 |..........Y...U.|
11 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
12 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
13 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
14 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
15 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
16 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
17 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
18 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
19 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
20 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
21 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
22 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
23 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
24 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
25 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
26 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
27 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
28 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
29 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
30 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
31 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
32 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
33 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
34 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
35 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
36 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
37 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
38 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
39 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
40 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
41 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
42 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
43 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
44 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
45 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
46 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
47 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
48 | 00000290 3b e9 fa e7 16 03 00 00 04 0e 00 00 00 |;............|
49 | >>> Flow 3 (client to server)
50 | 00000000 16 03 00 00 84 10 00 00 80 d2 67 c1 73 bb 95 8d |..........g.s...|
51 | 00000010 b2 e7 30 ca 6c 53 eb f0 34 e5 26 11 0b 91 e9 0a |..0.lS..4.&.....|
52 | 00000020 cb 7d 9f d8 f9 01 38 06 01 83 29 a7 1d 69 b8 a1 |.}....8...)..i..|
53 | 00000030 1f aa bf 73 1e 26 82 ed 44 f5 82 ec 95 69 88 4b |...s.&..D....i.K|
54 | 00000040 b7 ce dd 52 c1 a6 3f be b8 02 23 a5 f3 0c 1e 36 |...R..?...#....6|
55 | 00000050 f9 c9 00 1f da e9 d5 38 48 b0 24 5e 25 c1 d4 cb |.......8H.$^%...|
56 | 00000060 64 c2 16 ff 94 d6 bd e2 e1 bf 7a 98 d9 77 09 a1 |d.........z..w..|
57 | 00000070 c4 f0 99 e6 57 89 02 c8 dd f0 d5 94 d8 44 34 0b |....W........D4.|
58 | 00000080 7a 08 52 95 75 20 02 0a 83 14 03 00 00 01 01 16 |z.R.u ..........|
59 | 00000090 03 00 00 3c e9 19 7a 94 45 9a b0 ec 3f 8f 1d 19 |...<..z.E...?...|
60 | 000000a0 64 65 45 6c e8 4e e3 c8 c8 c6 dc d3 a1 05 cf ea |deEl.N..........|
61 | 000000b0 fa cf 59 74 93 84 53 a3 bd 7b f0 07 64 92 ea a2 |..Yt..S..{..d...|
62 | 000000c0 f1 2a ea 29 4a 80 c6 99 76 3c 7e c3 f7 b0 e5 e2 |.*.)J...v<~.....|
63 | >>> Flow 4 (server to client)
64 | 00000000 14 03 00 00 01 01 16 03 00 00 3c 14 6c 96 8a 5e |..........<.l..^|
65 | 00000010 ab 93 c2 65 9b 22 57 31 e6 f1 ce 6a a2 28 31 e8 |...e."W1...j.(1.|
66 | 00000020 b5 c3 e7 07 98 2f 0b 40 b7 65 ec 92 f5 60 61 c2 |...../.@.e...`a.|
67 | 00000030 25 40 91 2f fa a4 4e 4a ad 7b b3 2a 26 23 d3 04 |%@./..NJ.{.*..|
68 | 00000040 0f c2 2e 95 82 9d 4b 17 03 00 00 21 5e c6 1e 2c |......K....!^..,|
69 | 00000050 49 23 4d 14 b2 87 4b c2 f9 09 17 f0 1a 11 15 50 |I#M...K........P|
70 | 00000060 52 d3 85 7b 25 0e e5 2c 7b 74 4b 5e 9d 15 03 00 |R..{%..,{tK^....|
71 | 00000070 00 16 6b aa 31 b5 e4 ff 02 0a 39 bc d7 57 51 a1 |..k.1.....9..WQ.|
72 | 00000080 42 07 c9 ba 2b 35 26 b7 |B...+5&.|
73 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv10-ECDHE-ECDSA-AES:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 00 63 01 00 00 5f 03 01 c7 00 ca ac 5f |....c..._......_|
3 | 00000010 08 6c a0 aa e8 a0 55 6f fb 20 ae 5d 6c 07 fa 6b |.l....Uo. .]l..k|
4 | 00000020 f8 2b 16 e2 46 ce f7 e7 c1 ba 5c 00 00 04 c0 0a |.+..F.....\.....|
5 | 00000030 00 ff 01 00 00 32 00 00 00 0e 00 0c 00 00 09 31 |.....2.........1|
6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
8 | 00000060 00 16 00 00 00 17 00 00 |........|
9 | >>> Flow 2 (server to client)
10 | 00000000 16 03 01 00 31 02 00 00 2d 03 01 00 00 00 00 00 |....1...-.......|
11 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
12 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 c0 0a 00 00 |...DOWNGRD......|
13 | 00000030 05 ff 01 00 01 00 16 03 01 02 0e 0b 00 02 0a 00 |................|
14 | 00000040 02 07 00 02 04 30 82 02 00 30 82 01 62 02 09 00 |.....0...0..b...|
15 | 00000050 b8 bf 2d 47 a0 d2 eb f4 30 09 06 07 2a 86 48 ce |..-G....0...*.H.|
16 | 00000060 3d 04 01 30 45 31 0b 30 09 06 03 55 04 06 13 02 |=..0E1.0...U....|
17 | 00000070 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d |AU1.0...U....Som|
18 | 00000080 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a |e-State1!0...U..|
19 | 00000090 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 |..Internet Widgi|
20 | 000000a0 74 73 20 50 74 79 20 4c 74 64 30 1e 17 0d 31 32 |ts Pty Ltd0...12|
21 | 000000b0 31 31 32 32 31 35 30 36 33 32 5a 17 0d 32 32 31 |1122150632Z..221|
22 | 000000c0 31 32 30 31 35 30 36 33 32 5a 30 45 31 0b 30 09 |120150632Z0E1.0.|
23 | 000000d0 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 55 |..U....AU1.0...U|
24 | 000000e0 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 21 |....Some-State1!|
25 | 000000f0 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e 65 |0...U....Interne|
26 | 00000100 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c 74 |t Widgits Pty Lt|
27 | 00000110 64 30 81 9b 30 10 06 07 2a 86 48 ce 3d 02 01 06 |d0..0...*.H.=...|
28 | 00000120 05 2b 81 04 00 23 03 81 86 00 04 00 c4 a1 ed be |.+...#..........|
29 | 00000130 98 f9 0b 48 73 36 7e c3 16 56 11 22 f2 3d 53 c3 |...Hs6~..V.".=S.|
30 | 00000140 3b 4d 21 3d cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc |;M!=.ku......&..|
31 | 00000150 b2 87 f0 72 32 7c b3 64 2f 1c 90 bc ea 68 23 10 |...r2|.d/....h#.|
32 | 00000160 7e fe e3 25 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 |~..%.H:i.(m.7...|
33 | 00000170 62 dd 0d a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 |b....pb....d1...|
34 | 00000180 31 bd 96 b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 |1...h..#.vd?.\..|
35 | 00000190 12 0e 58 58 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc |..XX._p.........|
36 | 000001a0 b9 b6 9f 30 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 |...0f[f. .'...;0|
37 | 000001b0 09 06 07 2a 86 48 ce 3d 04 01 03 81 8c 00 30 81 |...*.H.=......0.|
38 | 000001c0 88 02 42 01 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 |..B...O..E.H}...|
39 | 000001d0 ed 98 9d ae 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 |....Gp.^../...M.|
40 | 000001e0 61 40 d3 11 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b |a@......~.~.v..;|
41 | 000001f0 7e a5 3f ce fa 10 e2 59 ec 47 2d 7c ac da 4e 97 |~.?....Y.G-|..N.|
42 | 00000200 0e 15 a0 6f d0 02 42 01 4d fc be 67 13 9c 2d 05 |...o..B.M..g..-.|
43 | 00000210 0e bd 3f a3 8c 25 c1 33 13 83 0d 94 06 bb d4 37 |..?..%.3.......7|
44 | 00000220 7a f6 ec 7a c9 86 2e dd d7 11 69 7f 85 7c 56 de |z..z......i..|V.|
45 | 00000230 fb 31 78 2b e4 c7 78 0d ae cb be 9e 4e 36 24 31 |.1x+..x.....N6$1|
46 | 00000240 7b 6a 0f 39 95 12 07 8f 2a 16 03 01 00 b4 0c 00 |{j.9....*.......|
47 | 00000250 00 b0 03 00 1d 20 2f e5 7d a3 47 cd 62 43 15 28 |..... /.}.G.bC.(|
48 | 00000260 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 |.._.).0.........|
49 | 00000270 99 5f 58 cb 3b 74 00 8a 30 81 87 02 41 4f 15 dd |._X.;t..0...AO..|
50 | 00000280 a7 4a 1e 90 6f f5 4b 31 f7 8f c5 5f 26 60 0c d2 |.J..o.K1..._&`..|
51 | 00000290 ab 71 cf e4 3e 20 2e 83 9e 94 00 fc 92 4f 87 43 |.q..> .......O.C|
52 | 000002a0 e8 53 2f a3 ee 4a 4e 58 6e d5 5f 11 64 54 de cc |.S/..JNXn._.dT..|
53 | 000002b0 ae 83 b1 53 4a 16 1d 14 5c f0 fe 6b c1 7a 02 42 |...SJ...\..k.z.B|
54 | 000002c0 00 89 a0 e3 33 70 5f 20 c3 72 e7 93 1a fa b1 49 |....3p_ .r.....I|
55 | 000002d0 4a 46 83 f4 a3 88 24 c0 22 72 e6 09 ad a7 bd d1 |JF....$."r......|
56 | 000002e0 c8 c1 b3 7c 21 04 dc 67 58 8e 8e d4 bf 2d f3 d7 |...|!..gX....-..|
57 | 000002f0 c4 5a 06 d6 c1 65 84 dc 97 5c 0d 6f a4 64 d2 5f |.Z...e...\.o.d._|
58 | 00000300 47 99 16 03 01 00 04 0e 00 00 00 |G..........|
59 | >>> Flow 3 (client to server)
60 | 00000000 16 03 01 00 25 10 00 00 21 20 91 71 e4 59 10 64 |....%...! .q.Y.d|
61 | 00000010 19 77 13 21 9c 60 ee 81 58 ba 41 10 39 61 e0 a7 |.w.!.`..X.A.9a..|
62 | 00000020 73 4d ec e8 cd cc b5 e0 cc 6d 14 03 01 00 01 01 |sM.......m......|
63 | 00000030 16 03 01 00 30 5c 35 d5 37 46 1e 28 52 32 ed 35 |....0\5.7F.(R2.5|
64 | 00000040 44 37 9c ca 83 4c 06 80 ff 17 7c cd 7d e5 22 14 |D7...L....|.}.".|
65 | 00000050 0e 70 12 01 f0 e5 ce 5a ca be 41 e2 ee 48 9d 95 |.p.....Z..A..H..|
66 | 00000060 c3 51 0c 15 bb |.Q...|
67 | >>> Flow 4 (server to client)
68 | 00000000 14 03 01 00 01 01 16 03 01 00 30 ba 12 b3 9d e1 |..........0.....|
69 | 00000010 9a 4d 9d d4 74 50 d7 b0 db 05 68 53 ba 1f 4b 3a |.M..tP....hS..K:|
70 | 00000020 b5 c4 91 ee e6 ed d4 e9 07 c7 12 c5 90 42 f5 44 |.............B.D|
71 | 00000030 5a 34 59 07 9d fa 8c ec a4 7e 5f 17 03 01 00 20 |Z4Y......~_.... |
72 | 00000040 04 58 11 87 90 9b fe ae 63 39 15 07 ec 74 fd 9a |.X......c9...t..|
73 | 00000050 15 28 ec b0 75 c4 e8 7a c5 59 73 9c cf 85 75 af |.(..u..z.Ys...u.|
74 | 00000060 17 03 01 00 30 24 12 78 fc 37 d4 d8 ec 25 67 38 |....0$.x.7...%g8|
75 | 00000070 63 91 68 3a fc 97 26 ab 11 b9 4b 8f 20 8f 75 4f |c.h:..&...K. .uO|
76 | 00000080 ca 02 ef 2b 43 b1 4e 7a ed dd dc 36 93 ae 79 6f |...+C.Nz...6..yo|
77 | 00000090 c5 8c a2 39 d6 15 03 01 00 20 b0 a0 fb f1 40 b2 |...9..... ....@.|
78 | 000000a0 09 00 94 fd b3 f5 98 1e d6 fb e8 96 20 36 bb 4b |............ 6.K|
79 | 000000b0 4a 28 fb 51 0e 6e 7b fe 05 48 |J(.Q.n{..H|
80 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv10-RSA-3DES:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 00 63 01 00 00 5f 03 01 33 4b 5c 08 a3 |....c..._..3K\..|
3 | 00000010 64 52 8d 1f c9 55 bd 2e 03 e8 9d 88 f4 ff c0 35 |dR...U.........5|
4 | 00000020 33 ad d0 aa 7d f6 2d 42 0c c4 85 00 00 04 00 0a |3...}.-B........|
5 | 00000030 00 ff 01 00 00 32 00 00 00 0e 00 0c 00 00 09 31 |.....2.........1|
6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
8 | 00000060 00 16 00 00 00 17 00 00 |........|
9 | >>> Flow 2 (server to client)
10 | 00000000 16 03 01 00 31 02 00 00 2d 03 01 00 00 00 00 00 |....1...-.......|
11 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
12 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 0a 00 00 |...DOWNGRD......|
13 | 00000030 05 ff 01 00 01 00 16 03 01 02 59 0b 00 02 55 00 |..........Y...U.|
14 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
15 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
16 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
17 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
18 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
19 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
20 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
21 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
22 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
23 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
24 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
25 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
26 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
27 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
28 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
29 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
30 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
31 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
32 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
33 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
34 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
35 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
36 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
37 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
38 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
39 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
40 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
41 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
42 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
43 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
44 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
45 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
46 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
47 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
48 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
49 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
50 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
51 | 00000290 3b e9 fa e7 16 03 01 00 04 0e 00 00 00 |;............|
52 | >>> Flow 3 (client to server)
53 | 00000000 16 03 01 00 86 10 00 00 82 00 80 69 ea b8 fd 3a |...........i...:|
54 | 00000010 76 cb 76 4d b2 7a 0e 61 4d 9d 9e 26 13 02 07 aa |v.vM.z.aM..&....|
55 | 00000020 31 94 01 9f 57 00 80 f1 aa 75 06 09 65 42 c7 c8 |1...W....u..eB..|
56 | 00000030 6d ea 8c 75 4e 69 35 d2 84 71 89 5a 44 f6 15 91 |m..uNi5..q.ZD...|
57 | 00000040 b0 a9 e1 ff 65 0a 51 fe 06 a3 2d eb cb 33 6e 07 |....e.Q...-..3n.|
58 | 00000050 dd 2f 02 fe d3 ec 89 7c 87 48 27 eb d8 8c 4c 6d |./.....|.H'...Lm|
59 | 00000060 95 4c 6f 8a a8 a0 fe 59 d6 a4 b4 7a a5 48 aa f1 |.Lo....Y...z.H..|
60 | 00000070 37 95 1d 4d 18 ee b0 a7 aa ca a8 18 65 83 8e 26 |7..M........e..&|
61 | 00000080 05 9c d6 76 ff 9b 40 65 b7 2e 47 14 03 01 00 01 |...v..@e..G.....|
62 | 00000090 01 16 03 01 00 28 fa 03 ae d2 47 ef 75 4e 99 79 |.....(....G.uN.y|
63 | 000000a0 69 87 be 5e 61 1f 0f 09 65 56 31 08 09 38 34 1b |i..^a...eV1..84.|
64 | 000000b0 41 6a 9e 2c 3b a9 11 62 34 a8 58 bc 1d 92 |Aj.,;..b4.X...|
65 | >>> Flow 4 (server to client)
66 | 00000000 14 03 01 00 01 01 16 03 01 00 28 a4 c5 9f 93 86 |..........(.....|
67 | 00000010 fe 08 22 16 05 20 81 e3 a3 38 74 5d 32 24 41 50 |..".. ...8t]2$AP|
68 | 00000020 f4 e4 6b dd 92 0b d6 77 86 44 32 f9 2d f0 52 0e |..k....w.D2.-.R.|
69 | 00000030 c4 98 02 17 03 01 00 18 20 ee 92 bf 46 ce 52 ed |........ ...F.R.|
70 | 00000040 ac 85 df cd 2a a7 c1 6c 82 be ed 55 9e 55 25 b2 |....*..l...U.U%.|
71 | 00000050 17 03 01 00 28 b0 45 3d 83 94 79 d1 a5 a3 b0 0a |....(.E=..y.....|
72 | 00000060 59 63 13 62 1e 66 c2 69 4d a4 8d e0 fb 87 cb dc |Yc.b.f.iM.......|
73 | 00000070 5e 51 49 05 82 4d d6 1e 40 78 f0 cd 4b 15 03 01 |^QI..M..@x..K...|
74 | 00000080 00 18 38 0e 60 43 55 25 82 d2 4c 97 cf cd a9 7a |..8.`CU%..L....z|
75 | 00000090 e8 8a 4a eb c1 8d 54 cb e6 92 |..J...T...|
76 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv10-RSA-AES:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 00 63 01 00 00 5f 03 01 a1 4c 20 79 0a |....c..._...L y.|
3 | 00000010 35 d6 8b 7d e7 f2 3e eb bd c2 72 73 a9 18 c2 9b |5..}..>...rs....|
4 | 00000020 8a a0 b6 ae 17 21 df 6f d0 b0 f8 00 00 04 00 2f |.....!.o......./|
5 | 00000030 00 ff 01 00 00 32 00 00 00 0e 00 0c 00 00 09 31 |.....2.........1|
6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
8 | 00000060 00 16 00 00 00 17 00 00 |........|
9 | >>> Flow 2 (server to client)
10 | 00000000 16 03 01 00 31 02 00 00 2d 03 01 00 00 00 00 00 |....1...-.......|
11 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
12 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 2f 00 00 |...DOWNGRD.../..|
13 | 00000030 05 ff 01 00 01 00 16 03 01 02 59 0b 00 02 55 00 |..........Y...U.|
14 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
15 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
16 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
17 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
18 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
19 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
20 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
21 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
22 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
23 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
24 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
25 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
26 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
27 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
28 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
29 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
30 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
31 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
32 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
33 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
34 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
35 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
36 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
37 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
38 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
39 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
40 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
41 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
42 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
43 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
44 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
45 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
46 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
47 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
48 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
49 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
50 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
51 | 00000290 3b e9 fa e7 16 03 01 00 04 0e 00 00 00 |;............|
52 | >>> Flow 3 (client to server)
53 | 00000000 16 03 01 00 86 10 00 00 82 00 80 95 ba 78 12 0e |.............x..|
54 | 00000010 c1 98 6b 93 f6 7d bd f4 8c 77 de 0a 0a 2a 6e 25 |..k..}...w...*n%|
55 | 00000020 18 a9 eb 41 c2 c0 63 26 82 7a ea 84 ad cc e8 e2 |...A..c&.z......|
56 | 00000030 d8 f1 20 e4 fb 39 87 b8 47 f3 8a 6c 9f b6 08 13 |.. ..9..G..l....|
57 | 00000040 b0 76 99 65 cf 68 87 c4 e7 54 ff 6d 5f 81 f2 9f |.v.e.h...T.m_...|
58 | 00000050 57 1d 21 e8 ed aa 50 17 e7 85 a5 74 6e 9c cc 84 |W.!...P....tn...|
59 | 00000060 bb 06 11 ec 67 8b dc cd 7a 31 4c 08 f4 16 5f d5 |....g...z1L..._.|
60 | 00000070 07 0d 17 aa 00 56 51 6a 4c f5 9d 81 40 27 77 45 |.....VQjL...@'wE|
61 | 00000080 78 4d 68 6d 96 f7 28 c8 bd 18 b1 14 03 01 00 01 |xMhm..(.........|
62 | 00000090 01 16 03 01 00 30 df 7f 74 cd e8 0f 09 06 dd a5 |.....0..t.......|
63 | 000000a0 84 46 db ad 71 85 1a 0d e5 f1 d2 f0 2a b2 ef bb |.F..q.......*...|
64 | 000000b0 0b 79 88 ab ad 39 6d 4b 16 ae 0e 07 9b 9c 3a ea |.y...9mK......:.|
65 | 000000c0 b9 4b 8a 4b 73 06 |.K.Ks.|
66 | >>> Flow 4 (server to client)
67 | 00000000 14 03 01 00 01 01 16 03 01 00 30 cd 95 e4 10 a8 |..........0.....|
68 | 00000010 1b dd 36 80 7c 9e 04 23 4c 23 57 0a 57 cf 9a 2e |..6.|..#L#W.W...|
69 | 00000020 07 6d 81 b0 27 f8 5c cc 3b a8 80 40 38 be e0 27 |.m..'.\.;..@8..'|
70 | 00000030 25 ed f2 7d b9 5e a0 76 68 f8 06 17 03 01 00 20 |%..}.^.vh...... |
71 | 00000040 9c 12 9d 3b a0 e5 04 8b 78 44 bc 80 68 22 2b 4c |...;....xD..h"+L|
72 | 00000050 64 f1 ca 5c 83 eb 27 e7 29 ad cc 7d d5 e6 ec 1d |d..\..'.)..}....|
73 | 00000060 17 03 01 00 30 6e 42 31 b0 3d 46 7d e6 08 8c 43 |....0nB1.=F}...C|
74 | 00000070 ea 48 53 34 29 b4 6e ac 2e c4 1f a3 fb fa 70 d5 |.HS4).n.......p.|
75 | 00000080 36 9b 94 4f 6f 3f 00 fa e3 f4 4b e6 b3 f2 0d e2 |6..Oo?....K.....|
76 | 00000090 0f 60 e4 34 4d 15 03 01 00 20 21 a1 22 a3 e1 71 |.`.4M.... !."..q|
77 | 000000a0 ab 28 89 7c 12 ed 12 f7 3e 8a 9a 0e c0 f5 2b 2e |.(.|....>.....+.|
78 | 000000b0 91 bd 3f 05 ff 48 1c 3c b5 af |..?..H.<..|
79 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv10-RSA-RC4:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 00 63 01 00 00 5f 03 01 79 6a d2 2d 89 |....c..._..yj.-.|
3 | 00000010 ce 1b 74 2f fd 6b ea e2 2d 21 56 0d e9 37 ce b9 |..t/.k..-!V..7..|
4 | 00000020 bc 96 ef 0c 71 66 7a 3b 13 3a 6b 00 00 04 00 05 |....qfz;.:k.....|
5 | 00000030 00 ff 01 00 00 32 00 00 00 0e 00 0c 00 00 09 31 |.....2.........1|
6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
8 | 00000060 00 16 00 00 00 17 00 00 |........|
9 | >>> Flow 2 (server to client)
10 | 00000000 16 03 01 00 31 02 00 00 2d 03 01 00 00 00 00 00 |....1...-.......|
11 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
12 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 05 00 00 |...DOWNGRD......|
13 | 00000030 05 ff 01 00 01 00 16 03 01 02 59 0b 00 02 55 00 |..........Y...U.|
14 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
15 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
16 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
17 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
18 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
19 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
20 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
21 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
22 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
23 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
24 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
25 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
26 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
27 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
28 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
29 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
30 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
31 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
32 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
33 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
34 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
35 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
36 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
37 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
38 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
39 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
40 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
41 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
42 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
43 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
44 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
45 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
46 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
47 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
48 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
49 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
50 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
51 | 00000290 3b e9 fa e7 16 03 01 00 04 0e 00 00 00 |;............|
52 | >>> Flow 3 (client to server)
53 | 00000000 16 03 01 00 86 10 00 00 82 00 80 d4 da 80 53 5a |..............SZ|
54 | 00000010 4c fc 0b c3 91 a0 b4 91 24 5a 6b 59 01 fa 05 52 |L.......$ZkY...R|
55 | 00000020 cb 37 8c de 51 58 d7 ac 24 e2 d3 ac ad e6 00 0f |.7..QX..$.......|
56 | 00000030 72 50 a4 81 c3 18 ef f9 cb 0f 8b 6a cd e5 0e 46 |rP.........j...F|
57 | 00000040 9a f1 3c 61 ed 31 d4 c0 35 61 14 1e e8 b5 0c b2 |..>> Flow 4 (server to client)
66 | 00000000 14 03 01 00 01 01 16 03 01 00 24 0a 1c be 60 96 |..........$...`.|
67 | 00000010 78 67 15 22 ac 38 39 87 80 f5 69 2b 08 32 01 23 |xg.".89...i+.2.#|
68 | 00000020 e0 96 b3 89 8c 57 5f e4 27 33 66 90 b9 47 bc 17 |.....W_.'3f..G..|
69 | 00000030 03 01 00 21 fd 10 f3 e3 e6 14 bf b2 72 ab f0 bb |...!........r...|
70 | 00000040 11 04 54 da cd 93 03 14 78 2c 26 32 44 2c 0c e8 |..T.....x,&2D,..|
71 | 00000050 7e 56 25 83 0f 15 03 01 00 16 0c 26 07 14 19 aa |~V%........&....|
72 | 00000060 7e 78 bf 39 96 07 44 3d a9 c6 50 7d dc c9 de f5 |~x.9..D=..P}....|
73 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv11-FallbackSCSV:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 00 77 01 00 00 73 03 02 0a 6b c9 55 9d |....w...s...k.U.|
3 | 00000010 bf 4e 61 b2 0a c7 c6 96 9f eb 90 91 87 ca d3 d3 |.Na.............|
4 | 00000020 62 dc b6 b4 db ea 41 fe 43 3e a3 00 00 14 c0 0a |b.....A.C>......|
5 | 00000030 c0 14 00 39 c0 09 c0 13 00 33 00 35 00 2f 00 ff |...9.....3.5./..|
6 | 00000040 56 00 01 00 00 36 00 00 00 0e 00 0c 00 00 09 31 |V....6.........1|
7 | 00000050 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
8 | 00000060 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
9 | 00000070 00 23 00 00 00 16 00 00 00 17 00 00 |.#..........|
10 | >>> Flow 2 (server to client)
11 | 00000000 15 03 02 00 02 02 56 |......V|
12 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv11-RSA-RC4:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 00 63 01 00 00 5f 03 02 ea cf 4a b4 40 |....c..._....J.@|
3 | 00000010 33 f1 d3 b2 c1 2a f6 d6 bb 3f 48 8c 1a d2 40 0f |3....*...?H...@.|
4 | 00000020 4a 1e e8 07 8a 06 19 45 6a 02 cb 00 00 04 00 05 |J......Ej.......|
5 | 00000030 00 ff 01 00 00 32 00 00 00 0e 00 0c 00 00 09 31 |.....2.........1|
6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
8 | 00000060 00 16 00 00 00 17 00 00 |........|
9 | >>> Flow 2 (server to client)
10 | 00000000 16 03 02 00 31 02 00 00 2d 03 02 00 00 00 00 00 |....1...-.......|
11 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
12 | 00000020 00 00 00 44 4f 57 4e 47 52 44 00 00 00 05 00 00 |...DOWNGRD......|
13 | 00000030 05 ff 01 00 01 00 16 03 02 02 59 0b 00 02 55 00 |..........Y...U.|
14 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
15 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
16 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
17 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
18 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
19 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
20 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
21 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
22 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
23 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
24 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
25 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
26 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
27 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
28 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
29 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
30 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
31 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
32 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
33 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
34 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
35 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
36 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
37 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
38 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
39 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
40 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
41 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
42 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
43 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
44 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
45 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
46 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
47 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
48 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
49 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
50 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
51 | 00000290 3b e9 fa e7 16 03 02 00 04 0e 00 00 00 |;............|
52 | >>> Flow 3 (client to server)
53 | 00000000 16 03 02 00 86 10 00 00 82 00 80 a2 98 fb e6 12 |................|
54 | 00000010 7d 1c 3c de 04 9c 01 11 41 69 a4 e3 74 62 88 36 |}.<.....Ai..tb.6|
55 | 00000020 97 b5 28 14 6a 6d 27 1b 7d 27 0f fd 5b 76 07 3f |..(.jm'.}'..[v.?|
56 | 00000030 3e 99 21 93 46 9d 2c a0 4c d9 54 25 70 11 b8 ac |>.!.F.,.L.T%p...|
57 | 00000040 8e 5c 29 31 2c b2 39 92 10 32 dc b0 60 af 2e d4 |.\)1,.9..2..`...|
58 | 00000050 b3 f7 ba 44 0a 6c e2 4b 38 18 4b 51 60 1b a5 0d |...D.l.K8.KQ`...|
59 | 00000060 bf ec 00 fb fd 53 1f 6e b5 eb cd 32 1b 15 e9 ea |.....S.n...2....|
60 | 00000070 5c 93 72 dc 67 94 39 ed 2d 1e 6f f9 10 da 79 50 |\.r.g.9.-.o...yP|
61 | 00000080 e1 d2 db 6f 34 38 d1 fb 2c 38 cb 14 03 02 00 01 |...o48..,8......|
62 | 00000090 01 16 03 02 00 24 b4 29 aa 9d 48 a3 59 07 f8 a8 |.....$.)..H.Y...|
63 | 000000a0 f0 aa aa 0f 63 dd 0e ca d6 20 45 6d 88 ba 52 e2 |....c.... Em..R.|
64 | 000000b0 f9 cd 2f 25 d3 88 b1 a6 cf 9d |../%......|
65 | >>> Flow 4 (server to client)
66 | 00000000 14 03 02 00 01 01 16 03 02 00 24 cc 9a e8 46 cc |..........$...F.|
67 | 00000010 e5 45 8c f6 aa 71 28 f7 1b 2a 51 f8 33 c3 08 a3 |.E...q(..*Q.3...|
68 | 00000020 cd 72 7d 38 a9 d1 6f b8 c6 ce ef ae 4f 3d 50 17 |.r}8..o.....O=P.|
69 | 00000030 03 02 00 21 e1 9b 1e f6 56 28 6d 78 53 96 a4 41 |...!....V(mxS..A|
70 | 00000040 7b a8 15 29 74 40 b5 f4 d3 ae b7 8b b2 01 53 dd |{..)t@........S.|
71 | 00000050 45 bf 3a 55 9d 15 03 02 00 16 cb a8 cb 98 ac 0d |E.:U............|
72 | 00000060 1c eb aa c4 2a 71 65 aa b4 c9 d7 90 f7 88 3b b0 |....*qe.......;.|
73 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv12-RSA-3DES:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 00 97 01 00 00 93 03 03 48 e2 22 70 f7 |...........H."p.|
3 | 00000010 9a 24 ce 92 69 d1 ff fc c0 c9 ba b2 da 8e 83 7a |.$..i..........z|
4 | 00000020 6e 8d 24 60 e2 e2 81 76 e6 72 37 00 00 04 00 0a |n.$`...v.r7.....|
5 | 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1|
6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
8 | 00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....|
9 | 00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................|
10 | 00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................|
11 | 00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............|
12 | >>> Flow 2 (server to client)
13 | 00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......|
14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 0a 00 00 |...DOWNGRD......|
16 | 00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.|
17 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
18 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
19 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
20 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
21 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
22 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
23 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
24 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
25 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
26 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
27 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
28 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
29 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
30 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
31 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
32 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
33 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
34 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
35 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
36 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
37 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
38 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
39 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
40 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
41 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
42 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
43 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
44 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
45 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
46 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
47 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
48 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
49 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
50 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
51 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
52 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
53 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
54 | 00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............|
55 | >>> Flow 3 (client to server)
56 | 00000000 16 03 03 00 86 10 00 00 82 00 80 20 44 e6 19 b2 |........... D...|
57 | 00000010 c5 9f 95 af 90 29 b2 5c e9 c5 29 8c a2 bd 72 49 |.....).\..)...rI|
58 | 00000020 8d c8 ea e8 cc bd 65 d9 1c fe 95 f0 60 0e ee 13 |......e.....`...|
59 | 00000030 ea 7b bf 59 3c 08 21 07 73 b7 04 16 a7 a5 98 2e |.{.Y<.!.s.......|
60 | 00000040 ab ee db c3 83 ea c8 b2 07 3e 76 a0 8f d4 8f df |.........>v.....|
61 | 00000050 70 91 b7 ed 12 54 e2 e7 68 cb ed 26 be 84 a9 24 |p....T..h..&...$|
62 | 00000060 fb 89 48 49 4e 9b 14 98 82 ab 64 0c a5 a0 ec 1d |..HIN.....d.....|
63 | 00000070 96 b7 83 c3 14 cb de a5 97 d1 86 28 b6 d4 65 5d |...........(..e]|
64 | 00000080 0b 45 04 37 02 53 8c 96 5d f8 d3 14 03 03 00 01 |.E.7.S..].......|
65 | 00000090 01 16 03 03 00 30 04 43 06 c4 96 f5 f6 23 5d 46 |.....0.C.....#]F|
66 | 000000a0 ec 3d f4 18 44 3f f8 d2 e9 74 37 22 56 df f2 35 |.=..D?...t7"V..5|
67 | 000000b0 3d a0 8d 8a 80 be 4e 40 66 28 4c 37 aa f7 43 cf |=.....N@f(L7..C.|
68 | 000000c0 9e 29 83 7b 39 28 |.).{9(|
69 | >>> Flow 4 (server to client)
70 | 00000000 14 03 03 00 01 01 16 03 03 00 30 00 00 00 00 00 |..........0.....|
71 | 00000010 00 00 00 27 75 8a 8d 43 68 0e af 19 6d d2 63 1c |...'u..Ch...m.c.|
72 | 00000020 44 51 0b 86 4c fc 16 1c 77 f8 96 1e 72 3d b9 45 |DQ..L...w...r=.E|
73 | 00000030 40 cc 70 bc 72 a3 d3 ff f6 e5 3f 17 03 03 00 30 |@.p.r.....?....0|
74 | 00000040 00 00 00 00 00 00 00 00 f4 cf bc 55 e6 d7 4f d2 |...........U..O.|
75 | 00000050 8f ae 52 8d 16 d0 44 9a c9 39 5b a7 69 bb 04 96 |..R...D..9[.i...|
76 | 00000060 c9 d9 0c 92 a0 da b4 52 c5 dd 20 cb 4b 8c ad 51 |.......R.. .K..Q|
77 | 00000070 15 03 03 00 20 00 00 00 00 00 00 00 00 43 52 b5 |.... ........CR.|
78 | 00000080 d2 98 37 93 69 73 49 27 08 75 76 54 e7 39 b3 4c |..7.isI'.uvT.9.L|
79 | 00000090 da 48 84 00 20 |.H.. |
80 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv12-RSA-AES-GCM:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 00 97 01 00 00 93 03 03 d3 6a 87 ad b2 |............j...|
3 | 00000010 a0 59 86 0e 34 86 c1 b3 c9 64 17 92 aa 87 04 05 |.Y..4....d......|
4 | 00000020 32 d4 2e aa a1 48 94 87 82 a7 ab 00 00 04 c0 2f |2....H........./|
5 | 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1|
6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
8 | 00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....|
9 | 00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................|
10 | 00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................|
11 | 00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............|
12 | >>> Flow 2 (server to client)
13 | 00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......|
14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 2f 00 00 |...DOWNGRD.../..|
16 | 00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.|
17 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
18 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
19 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
20 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
21 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
22 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
23 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
24 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
25 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
26 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
27 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
28 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
29 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
30 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
31 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
32 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
33 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
34 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
35 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
36 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
37 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
38 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
39 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
40 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
41 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
42 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
43 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
44 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
45 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
46 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
47 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
48 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
49 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
50 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
51 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
52 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
53 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
54 | 00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............|
55 | 000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)|
56 | 000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;|
57 | 000002c0 74 08 04 00 80 65 2f 82 18 27 04 84 db 3d c6 5e |t....e/..'...=.^|
58 | 000002d0 6b 33 f9 87 59 e1 06 0c ce a7 3a f9 bd e7 54 47 |k3..Y.....:...TG|
59 | 000002e0 03 58 f7 0b a3 16 6a 47 4b 61 b6 d9 0d 04 c8 95 |.X....jGKa......|
60 | 000002f0 f5 d5 e5 0f 1b d2 26 3b c5 67 c0 87 dd a5 da a8 |......&;.g......|
61 | 00000300 e1 7e 52 a1 6a 0d 10 e8 dd 2e 09 39 21 3e a2 0f |.~R.j......9!>..|
62 | 00000310 a2 00 e4 a1 a6 df a8 3f 5d 1b d7 22 f8 b8 b5 32 |.......?].."...2|
63 | 00000320 31 3a 36 16 9e 6c ab f1 d5 25 ae 3c 4a 11 c8 ae |1:6..l...%..cuo.....|
65 | 00000340 11 40 c9 7f ca 16 03 03 00 04 0e 00 00 00 |.@............|
66 | >>> Flow 3 (client to server)
67 | 00000000 16 03 03 00 25 10 00 00 21 20 d1 f3 61 78 d1 34 |....%...! ..ax.4|
68 | 00000010 36 b4 9f 5e e5 24 1e 48 02 be f0 13 c2 3d b0 ce |6..^.$.H.....=..|
69 | 00000020 fb 96 39 6b 96 76 aa 87 18 41 14 03 03 00 01 01 |..9k.v...A......|
70 | 00000030 16 03 03 00 28 27 e1 50 92 20 e1 2c 98 b6 15 8f |....('.P. .,....|
71 | 00000040 dd bd 26 98 04 12 5d cb 29 66 ab 2d 37 f3 8e eb |..&...].)f.-7...|
72 | 00000050 3e 14 3b cf 4d 99 c4 2e ea 7c 04 a5 45 |>.;.M....|..E|
73 | >>> Flow 4 (server to client)
74 | 00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....|
75 | 00000010 00 00 00 88 39 9d c1 8d 8c bb c4 79 ba a5 2a bd |....9......y..*.|
76 | 00000020 34 62 bf 66 85 b5 cd 2e f7 1e 6e b4 96 1c f6 b3 |4b.f......n.....|
77 | 00000030 13 ba c9 17 03 03 00 25 00 00 00 00 00 00 00 01 |.......%........|
78 | 00000040 c3 ca b5 57 11 26 ec 18 be 00 6c 8b 79 a5 ed f7 |...W.&....l.y...|
79 | 00000050 7d ae 42 ff a2 8b fb 68 d0 08 0f 2e d1 15 03 03 |}.B....h........|
80 | 00000060 00 1a 00 00 00 00 00 00 00 02 58 ad 11 d2 74 5c |..........X...t\|
81 | 00000070 17 f2 60 e5 d9 fa 0e 47 5a 48 31 f7 |..`....GZH1.|
82 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv12-RSA-RC4:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 00 97 01 00 00 93 03 03 c7 7f 29 46 41 |.............)FA|
3 | 00000010 08 97 7c 3f 77 e0 11 8f 14 30 23 3e fa fc ca f3 |..|?w....0#>....|
4 | 00000020 45 10 83 10 1f 8f 25 b6 9d c1 4d 00 00 04 00 05 |E.....%...M.....|
5 | 00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1|
6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
7 | 00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
8 | 00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....|
9 | 00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................|
10 | 00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................|
11 | 00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............|
12 | >>> Flow 2 (server to client)
13 | 00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......|
14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 05 00 00 |...DOWNGRD......|
16 | 00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.|
17 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
18 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
19 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
20 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
21 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
22 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
23 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
24 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
25 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
26 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
27 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
28 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
29 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
30 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
31 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
32 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
33 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
34 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
35 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
36 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
37 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
38 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
39 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
40 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
41 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
42 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
43 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
44 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
45 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
46 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
47 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
48 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
49 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
50 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
51 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
52 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
53 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
54 | 00000290 3b e9 fa e7 16 03 03 00 04 0e 00 00 00 |;............|
55 | >>> Flow 3 (client to server)
56 | 00000000 16 03 03 00 86 10 00 00 82 00 80 d1 b0 57 28 da |.............W(.|
57 | 00000010 7a f8 46 7c c2 24 0d e0 04 48 33 d4 bc d7 f0 d0 |z.F|.$...H3.....|
58 | 00000020 85 fb ff 22 27 20 91 42 19 55 7b ef d8 fd 72 42 |..."' .B.U{...rB|
59 | 00000030 75 e6 71 e4 9f 67 30 72 68 b6 0e 00 34 d3 2f b8 |u.q..g0rh...4./.|
60 | 00000040 23 1b 00 43 17 68 fd 0f 90 ee 97 16 23 36 90 02 |#..C.h......#6..|
61 | 00000050 5c 71 10 03 80 ea 74 ef a4 5a ac e4 9f 48 f0 76 |\q....t..Z...H.v|
62 | 00000060 62 43 17 05 7c 8f 59 1d 16 b1 97 48 99 8d 66 5e |bC..|.Y....H..f^|
63 | 00000070 83 20 b3 02 e4 ac 73 52 b2 24 21 06 5a 49 89 df |. ....sR.$!.ZI..|
64 | 00000080 4b ad 4e f4 a9 7b 0c 3a b1 39 5d 14 03 03 00 01 |K.N..{.:.9].....|
65 | 00000090 01 16 03 03 00 24 8b de 7e 10 53 71 e0 0b 68 f6 |.....$..~.Sq..h.|
66 | 000000a0 36 67 66 c2 b9 0a c0 3e 39 0d ab 2e eb 5e eb 06 |6gf....>9....^..|
67 | 000000b0 a6 45 2b d7 48 8f c0 5e f3 a0 |.E+.H..^..|
68 | >>> Flow 4 (server to client)
69 | 00000000 14 03 03 00 01 01 16 03 03 00 24 ee dc 70 d2 3a |..........$..p.:|
70 | 00000010 f1 9c c6 c8 01 01 84 4f 3c 95 a3 ac 7a 78 92 3d |.......O<...zx.=|
71 | 00000020 8c 05 a1 db 34 fe 92 f2 9e f3 81 a1 33 a5 7f 17 |....4.......3...|
72 | 00000030 03 03 00 21 6e a9 f8 f9 99 0b c1 f5 8a d0 ab 93 |...!n...........|
73 | 00000040 15 4d 2f 24 1c 0b 43 77 cf 14 60 87 b0 8d f7 80 |.M/$..Cw..`.....|
74 | 00000050 c0 69 ea f6 9e 15 03 03 00 16 ef 09 73 d8 06 ec |.i..........s...|
75 | 00000060 b8 02 14 9c d3 39 32 d4 3d 94 ec 17 79 1d a9 d3 |.....92.=...y...|
76 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv12-RSA-RSAPKCS1v15:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 00 91 01 00 00 8d 03 03 c1 6b f6 4d 77 |............k.Mw|
3 | 00000010 95 dc 8a 54 04 62 4a b4 dc e3 06 51 b8 88 4e 9f |...T.bJ....Q..N.|
4 | 00000020 9a f5 2b 87 82 51 df e9 54 c7 93 00 00 2a c0 30 |..+..Q..T....*.0|
5 | 00000030 00 9f cc a8 cc aa c0 2f 00 9e c0 28 00 6b c0 27 |......./...(.k.'|
6 | 00000040 00 67 c0 14 00 39 c0 13 00 33 00 9d 00 9c 00 3d |.g...9...3.....=|
7 | 00000050 00 3c 00 35 00 2f 00 ff 01 00 00 3a 00 00 00 0e |.<.5./.....:....|
8 | 00000060 00 0c 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b |.....127.0.0.1..|
9 | 00000070 00 04 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 |................|
10 | 00000080 00 1e 00 19 00 18 00 16 00 00 00 17 00 00 00 0d |................|
11 | 00000090 00 04 00 02 04 01 |......|
12 | >>> Flow 2 (server to client)
13 | 00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......|
14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 30 00 00 |...DOWNGRD...0..|
16 | 00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.|
17 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
18 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
19 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
20 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
21 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
22 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
23 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
24 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
25 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
26 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
27 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
28 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
29 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
30 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
31 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
32 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
33 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
34 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
35 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
36 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
37 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
38 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
39 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
40 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
41 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
42 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
43 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
44 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
45 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
46 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
47 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
48 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
49 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
50 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
51 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
52 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
53 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
54 | 00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............|
55 | 000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)|
56 | 000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;|
57 | 000002c0 74 04 01 00 80 15 c5 ee da 37 f8 6d b8 9e 7c 68 |t........7.m..|h|
58 | 000002d0 b2 08 2a 8d 79 6c 6e 95 4e b5 6f 8e 84 24 31 d4 |..*.yln.N.o..$1.|
59 | 000002e0 e7 8c 6c 7e 9c 58 a4 fe 18 59 aa f7 0d 7d ff 7a |..l~.X...Y...}.z|
60 | 000002f0 f2 b0 eb b6 d3 4f fa 3f 36 0d 2e 43 8e d7 96 14 |.....O.?6..C....|
61 | 00000300 99 a0 34 6a 51 cf 49 48 2f 6a 69 3b e4 ec 8b 61 |..4jQ.IH/ji;...a|
62 | 00000310 a1 f4 ea 20 c5 72 90 b1 c6 54 75 42 4e f6 1f 12 |... .r...TuBN...|
63 | 00000320 da e1 98 36 01 02 30 b4 75 7b 4f 4b f1 4f ac 20 |...6..0.u{OK.O. |
64 | 00000330 ac c8 d2 0f 8f 2a 00 09 b8 2c ab 9e 5f b2 ce 25 |.....*...,.._..%|
65 | 00000340 e3 a3 27 9d 53 16 03 03 00 04 0e 00 00 00 |..'.S.........|
66 | >>> Flow 3 (client to server)
67 | 00000000 16 03 03 00 25 10 00 00 21 20 fe 11 76 84 dd 42 |....%...! ..v..B|
68 | 00000010 d9 fd ad 50 81 7e 62 d4 38 cb b3 5d ec c8 5a 7a |...P.~b.8..]..Zz|
69 | 00000020 40 d9 10 23 2f e6 c7 a8 95 3b 14 03 03 00 01 01 |@..#/....;......|
70 | 00000030 16 03 03 00 28 61 18 1a 65 0c 24 59 01 fe 28 fc |....(a..e.$Y..(.|
71 | 00000040 4f 7f d9 c5 6d b7 bf 9c 5c 8b dc 91 e7 48 40 72 |O...m...\....H@r|
72 | 00000050 06 4d 49 a4 4d 32 e2 10 b9 36 a4 06 a6 |.MI.M2...6...|
73 | >>> Flow 4 (server to client)
74 | 00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....|
75 | 00000010 00 00 00 6c 7b 84 e6 84 d3 31 8e 6a 3e e7 7e f2 |...l{....1.j>.~.|
76 | 00000020 94 16 6c 6f 01 a9 2d f7 de 5d 94 b2 9c 4b f0 51 |..lo..-..]...K.Q|
77 | 00000030 70 9e 3c 17 03 03 00 25 00 00 00 00 00 00 00 01 |p.<....%........|
78 | 00000040 94 ca c5 e7 58 20 7d 3b 74 9d e0 97 a2 dd 63 ab |....X };t.....c.|
79 | 00000050 33 08 2f 16 69 59 ba 0e 82 52 75 98 eb 15 03 03 |3./.iY...Ru.....|
80 | 00000060 00 1a 00 00 00 00 00 00 00 02 fc 38 72 72 09 6a |...........8rr.j|
81 | 00000070 ee c0 61 39 50 71 ad d3 ec a9 d1 0e |..a9Pq......|
82 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv12-RSA-RSAPSS:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 00 91 01 00 00 8d 03 03 0f 06 da 7d 85 |..............}.|
3 | 00000010 33 d8 3c c3 ad c5 19 f8 06 d8 f6 02 80 9a fb 8c |3.<.............|
4 | 00000020 55 a5 6b 67 c4 6e 68 11 74 61 28 00 00 2a c0 30 |U.kg.nh.ta(..*.0|
5 | 00000030 00 9f cc a8 cc aa c0 2f 00 9e c0 28 00 6b c0 27 |......./...(.k.'|
6 | 00000040 00 67 c0 14 00 39 c0 13 00 33 00 9d 00 9c 00 3d |.g...9...3.....=|
7 | 00000050 00 3c 00 35 00 2f 00 ff 01 00 00 3a 00 00 00 0e |.<.5./.....:....|
8 | 00000060 00 0c 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b |.....127.0.0.1..|
9 | 00000070 00 04 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 |................|
10 | 00000080 00 1e 00 19 00 18 00 16 00 00 00 17 00 00 00 0d |................|
11 | 00000090 00 04 00 02 08 04 |......|
12 | >>> Flow 2 (server to client)
13 | 00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......|
14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 30 00 00 |...DOWNGRD...0..|
16 | 00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.|
17 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
18 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
19 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
20 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
21 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
22 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
23 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
24 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
25 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
26 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
27 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
28 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
29 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
30 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
31 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
32 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
33 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
34 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
35 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
36 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
37 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
38 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
39 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
40 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
41 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
42 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
43 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
44 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
45 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
46 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
47 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
48 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
49 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
50 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
51 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
52 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
53 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
54 | 00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............|
55 | 000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)|
56 | 000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;|
57 | 000002c0 74 08 04 00 80 49 30 b1 a5 47 19 7f a7 35 61 cb |t....I0..G...5a.|
58 | 000002d0 dc 41 47 f0 6a 96 e1 63 48 d9 4f d3 a4 ac 06 46 |.AG.j..cH.O....F|
59 | 000002e0 f2 8d 07 95 25 c6 61 59 4a df 35 2e ce dd 71 7e |....%.aYJ.5...q~|
60 | 000002f0 1e d6 f4 9f 43 93 84 35 6a 98 41 45 16 ee cb 14 |....C..5j.AE....|
61 | 00000300 dd bb 52 27 08 d5 a2 39 e7 6e f6 d6 e4 c6 bd f3 |..R'...9.n......|
62 | 00000310 b6 9b 6d 61 30 2a 07 c6 04 39 87 fd 99 00 15 78 |..ma0*...9.....x|
63 | 00000320 3d bf 20 8c b9 52 fb 5d c7 b7 77 78 fb 77 2a ac |=. ..R.]..wx.w*.|
64 | 00000330 f5 3e e5 4b 8f 4d 9b ca c2 33 1c 66 3c cb e0 1f |.>.K.M...3.f<...|
65 | 00000340 81 36 78 39 70 16 03 03 00 04 0e 00 00 00 |.6x9p.........|
66 | >>> Flow 3 (client to server)
67 | 00000000 16 03 03 00 25 10 00 00 21 20 79 9a e7 42 96 52 |....%...! y..B.R|
68 | 00000010 f6 52 7d 10 9a 36 9b aa a7 2f 96 be 5b 0a 3b 40 |.R}..6.../..[.;@|
69 | 00000020 d9 32 3a 0b 17 7b 8d 92 7c 7b 14 03 03 00 01 01 |.2:..{..|{......|
70 | 00000030 16 03 03 00 28 92 3e da 41 d2 87 60 b3 e1 4f f7 |....(.>.A..`..O.|
71 | 00000040 bb b7 09 50 47 2e 05 d5 fe f6 ed 94 ba 3b 60 aa |...PG........;`.|
72 | 00000050 38 2d b2 38 c7 07 64 63 dd ca 1a 8e ae |8-.8..dc.....|
73 | >>> Flow 4 (server to client)
74 | 00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....|
75 | 00000010 00 00 00 8e c6 6e 45 21 eb 35 11 7a b5 74 d7 f7 |.....nE!.5.z.t..|
76 | 00000020 67 53 15 23 9d 61 a1 bc 20 10 c8 8e 7e ee 45 fc |gS.#.a.. ...~.E.|
77 | 00000030 60 13 20 17 03 03 00 25 00 00 00 00 00 00 00 01 |`. ....%........|
78 | 00000040 bf f9 63 b5 b1 39 70 43 c7 62 38 be d1 f5 0d a5 |..c..9pC.b8.....|
79 | 00000050 87 91 95 71 ab 03 c2 08 d0 38 dc 70 9a 15 03 03 |...q.....8.p....|
80 | 00000060 00 1a 00 00 00 00 00 00 00 02 0c 6f b1 f5 45 6d |...........o..Em|
81 | 00000070 44 2c 1f ec a4 fa 5c c1 aa 23 1e 82 |D,....\..#..|
82 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv12-Resume:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 01 33 01 00 01 2f 03 03 b0 fe 51 14 a8 |....3.../....Q..|
3 | 00000010 15 64 e2 64 e4 8e 4f 93 bf 17 38 50 d8 fb 4c fb |.d.d..O...8P..L.|
4 | 00000020 03 04 a2 c0 9d b9 d2 19 8f e6 9a 20 5e e4 28 dd |........... ^.(.|
5 | 00000030 e1 a6 89 f5 b2 5e 1a 7b d3 af 0a bb 19 dc e1 2f |.....^.{......./|
6 | 00000040 58 d7 9e 59 a7 b7 de 07 bb 06 4d 0c 00 04 00 2f |X..Y......M..../|
7 | 00000050 00 ff 01 00 00 e2 00 00 00 0e 00 0c 00 00 09 31 |...............1|
8 | 00000060 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
9 | 00000070 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
10 | 00000080 00 23 00 78 50 46 ad c1 db a8 38 86 7b 2b bb fd |.#.xPF....8.{+..|
11 | 00000090 d0 c3 42 3e 00 00 00 00 00 00 00 00 00 00 00 00 |..B>............|
12 | 000000a0 00 00 00 00 94 6f 2c 9f 83 61 fe 79 79 ae dc c2 |.....o,..a.yy...|
13 | 000000b0 a0 99 e2 59 46 79 88 b8 ed 74 da ef da 3e 7e 69 |...YFy...t...>~i|
14 | 000000c0 af 34 63 b3 7f 52 e1 07 4d f8 40 69 63 85 8c 66 |.4c..R..M.@ic..f|
15 | 000000d0 a6 d6 f7 b7 b0 f2 d4 12 f4 2a 33 94 64 76 91 5b |.........*3.dv.[|
16 | 000000e0 6c 7d 49 37 3c 0b 76 3e d6 5c 0b 65 79 96 31 51 |l}I7<.v>.\.ey.1Q|
17 | 000000f0 46 01 51 94 38 5b 51 d5 2d 1a 8b 19 00 16 00 00 |F.Q.8[Q.-.......|
18 | 00000100 00 17 00 00 00 0d 00 30 00 2e 04 03 05 03 06 03 |.......0........|
19 | 00000110 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 08 06 |................|
20 | 00000120 04 01 05 01 06 01 03 03 02 03 03 01 02 01 03 02 |................|
21 | 00000130 02 02 04 02 05 02 06 02 |........|
22 | >>> Flow 2 (server to client)
23 | 00000000 16 03 03 00 51 02 00 00 4d 03 03 00 00 00 00 00 |....Q...M.......|
24 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
25 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 20 5e e4 28 dd |...DOWNGRD. ^.(.|
26 | 00000030 e1 a6 89 f5 b2 5e 1a 7b d3 af 0a bb 19 dc e1 2f |.....^.{......./|
27 | 00000040 58 d7 9e 59 a7 b7 de 07 bb 06 4d 0c 00 2f 00 00 |X..Y......M../..|
28 | 00000050 05 ff 01 00 01 00 14 03 03 00 01 01 16 03 03 00 |................|
29 | 00000060 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |@...............|
30 | 00000070 00 c6 4d ae 43 25 3e 7a 8b 1d bc 77 6f 6d 05 c8 |..M.C%>z...wom..|
31 | 00000080 93 a1 d0 ee 81 0b e6 3e e6 0d 55 ff 3a 76 f3 e1 |.......>..U.:v..|
32 | 00000090 49 0b e4 3b d2 1c cb 2d 9f 1e 03 cb f9 8c 60 96 |I..;...-......`.|
33 | 000000a0 b1 |.|
34 | >>> Flow 3 (client to server)
35 | 00000000 14 03 03 00 01 01 16 03 03 00 40 c9 ab 6e 5b 04 |..........@..n[.|
36 | 00000010 35 28 90 72 16 86 e8 ad a5 4d 2e f8 5a ee 42 8e |5(.r.....M..Z.B.|
37 | 00000020 6c 3f a4 00 3a de a8 c5 8f e3 59 15 10 09 31 91 |l?..:.....Y...1.|
38 | 00000030 5c ad a1 b1 15 bc fd a1 4a 91 4b 7a 50 a7 37 c4 |\.......J.KzP.7.|
39 | 00000040 3b 9d 3b 30 8e cd 8c ec b3 bc 94 |;.;0.......|
40 | >>> Flow 4 (server to client)
41 | 00000000 17 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........|
42 | 00000010 00 00 00 00 00 95 7d fd bf 36 bd 7d 5f 42 2f 0a |......}..6.}_B/.|
43 | 00000020 84 27 ed 2d 76 07 cb 5a 96 93 74 68 9f 2a 66 fa |.'.-v..Z..th.*f.|
44 | 00000030 85 b0 38 bc da 8d 11 7f 80 80 21 ed 34 db 58 91 |..8.......!.4.X.|
45 | 00000040 b0 d7 8d 08 f1 15 03 03 00 30 00 00 00 00 00 00 |.........0......|
46 | 00000050 00 00 00 00 00 00 00 00 00 00 6f ed 4a be 10 ea |..........o.J...|
47 | 00000060 6a 75 ee 69 c2 2c f7 54 8a 18 aa 5f 7c 65 d0 d8 |ju.i.,.T..._|e..|
48 | 00000070 0c 94 dc a8 47 45 83 e6 68 09 |....GE..h.|
49 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv12-X25519:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 00 8f 01 00 00 8b 03 03 77 a6 19 8a 94 |...........w....|
3 | 00000010 4a 1a d4 51 10 98 c3 22 5d 5d 76 2d 4f 27 ea e8 |J..Q..."]]v-O'..|
4 | 00000020 61 d0 10 7a 08 43 23 42 b0 e0 12 00 00 04 c0 2f |a..z.C#B......./|
5 | 00000030 00 ff 01 00 00 5e 00 00 00 0e 00 0c 00 00 09 31 |.....^.........1|
6 | 00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
7 | 00000050 00 0a 00 04 00 02 00 1d 00 16 00 00 00 17 00 00 |................|
8 | 00000060 00 0d 00 30 00 2e 04 03 05 03 06 03 08 07 08 08 |...0............|
9 | 00000070 08 09 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 |................|
10 | 00000080 06 01 03 03 02 03 03 01 02 01 03 02 02 02 04 02 |................|
11 | 00000090 05 02 06 02 |....|
12 | >>> Flow 2 (server to client)
13 | 00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......|
14 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
15 | 00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 2f 00 00 |...DOWNGRD.../..|
16 | 00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.|
17 | 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......|
18 | 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..|
19 | 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.|
20 | 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..|
21 | 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..|
22 | 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..|
23 | 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1|
24 | 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.|
25 | 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...|
26 | 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0|
27 | 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.|
28 | 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6|
29 | 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.|
30 | 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....|
31 | 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......|
32 | 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$|
33 | 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..|
34 | 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u|
35 | 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.|
36 | 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........|
37 | 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.|
38 | 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......|
39 | 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.|
40 | 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>|
41 | 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#|
42 | 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..|
43 | 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0|
44 | 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan|
45 | 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........|
46 | 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...|
47 | 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1|
48 | 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d|
49 | 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..|
50 | 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....|
51 | 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......|
52 | 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..|
53 | 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.|
54 | 00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............|
55 | 000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)|
56 | 000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;|
57 | 000002c0 74 08 04 00 80 0f e7 f4 b4 b9 f2 83 95 26 d7 70 |t............&.p|
58 | 000002d0 5f b2 e3 5e 42 86 b6 67 0a df 4e 60 2d d2 91 be |_..^B..g..N`-...|
59 | 000002e0 2c ba c1 24 9c 57 29 eb aa df 52 e5 8e 5f 9c ab |,..$.W)...R.._..|
60 | 000002f0 9c 88 c5 8a 92 fd b6 d5 e2 6b 0d ea 1c de 73 22 |.........k....s"|
61 | 00000300 a1 51 05 e0 b6 87 e1 e4 2b 8e 1d 06 26 53 37 4e |.Q......+...&S7N|
62 | 00000310 c7 8f 05 4a 0c 48 69 d3 7b f8 44 33 7b 2b 54 f5 |...J.Hi.{.D3{+T.|
63 | 00000320 d9 a8 70 f3 6d b5 1c e4 4d 53 5f 0d 29 76 92 d3 |..p.m...MS_.)v..|
64 | 00000330 63 19 25 b0 8c c6 31 13 e4 b5 d5 d0 b9 47 ed 54 |c.%...1......G.T|
65 | 00000340 28 82 6c 04 a9 16 03 03 00 04 0e 00 00 00 |(.l...........|
66 | >>> Flow 3 (client to server)
67 | 00000000 16 03 03 00 25 10 00 00 21 20 a4 db 55 a3 5a 6f |....%...! ..U.Zo|
68 | 00000010 af bf a2 53 ad 81 4d ea ef c0 d7 02 5d 42 9f ee |...S..M.....]B..|
69 | 00000020 34 ff bf 08 c9 13 56 8c e3 26 14 03 03 00 01 01 |4.....V..&......|
70 | 00000030 16 03 03 00 28 bd 32 89 70 2a eb 54 d1 ae 60 08 |....(.2.p*.T..`.|
71 | 00000040 4e 05 c9 e8 bb a7 fc 96 56 1a ba c7 51 a5 4d 2a |N.......V...Q.M*|
72 | 00000050 de da 6e a9 97 82 aa 37 44 00 4a 1f 0a |..n....7D.J..|
73 | >>> Flow 4 (server to client)
74 | 00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....|
75 | 00000010 00 00 00 7e 16 80 9b 85 03 3b 19 35 dc 22 75 4d |...~.....;.5."uM|
76 | 00000020 08 36 ad ee 24 f2 75 de fe c2 c6 ba 91 62 1d 29 |.6..$.u......b.)|
77 | 00000030 68 53 d3 17 03 03 00 25 00 00 00 00 00 00 00 01 |hS.....%........|
78 | 00000040 65 36 ef c0 52 ae be bc 94 af 01 d6 c1 a8 2c 04 |e6..R.........,.|
79 | 00000050 3c 83 a2 88 61 7f 41 c0 76 ec aa 52 8d 15 03 03 |<...a.A.v..R....|
80 | 00000060 00 1a 00 00 00 00 00 00 00 02 4a dd b0 50 cf 59 |..........J..P.Y|
81 | 00000070 01 67 74 45 f2 ae 47 f1 38 ef 51 04 |.gtE..G.8.Q.|
82 |
--------------------------------------------------------------------------------
/utls/testdata/Server-TLSv13-Resume:
--------------------------------------------------------------------------------
1 | >>> Flow 1 (client to server)
2 | 00000000 16 03 01 01 a4 01 00 01 a0 03 03 92 e8 fa 14 82 |................|
3 | 00000010 03 7c cd fe 01 82 55 99 8b fd 04 ff 88 82 98 c9 |.|....U.........|
4 | 00000020 72 18 3b 2e 0a de fc a4 44 9f 1d 20 c0 df df c9 |r.;.....D.. ....|
5 | 00000030 1d ed 19 9e 2d ce 57 f6 95 54 67 76 77 64 c7 f4 |....-.W..Tgvwd..|
6 | 00000040 ad 18 7d d8 58 6f 08 30 a5 a4 50 cd 00 08 13 02 |..}.Xo.0..P.....|
7 | 00000050 13 03 13 01 00 ff 01 00 01 4f 00 00 00 0e 00 0c |.........O......|
8 | 00000060 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....|
9 | 00000070 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................|
10 | 00000080 00 19 00 18 00 23 00 00 00 16 00 00 00 17 00 00 |.....#..........|
11 | 00000090 00 0d 00 1e 00 1c 04 03 05 03 06 03 08 07 08 08 |................|
12 | 000000a0 08 09 08 0a 08 0b 08 04 08 05 08 06 04 01 05 01 |................|
13 | 000000b0 06 01 00 2b 00 03 02 03 04 00 2d 00 02 01 01 00 |...+......-.....|
14 | 000000c0 33 00 26 00 24 00 1d 00 20 94 44 cd ce 27 a8 43 |3.&.$... .D..'.C|
15 | 000000d0 8a ef cd ef d4 74 d4 e4 62 82 00 e6 46 96 e5 aa |.....t..b...F...|
16 | 000000e0 d1 44 8a 55 6b d7 25 06 6f 00 29 00 bc 00 87 00 |.D.Uk.%.o.).....|
17 | 000000f0 81 50 46 ad c1 db a8 38 86 7b 2b bb fd d0 c3 42 |.PF....8.{+....B|
18 | 00000100 3e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |>...............|
19 | 00000110 00 94 68 2c a3 81 51 ed 14 ef 68 ca 42 c5 4c 1f |..h,..Q...h.B.L.|
20 | 00000120 90 bf 3c 07 2b e5 52 22 a0 c0 46 db cb f6 b9 a0 |..<.+.R"..F.....|
21 | 00000130 b5 56 b0 d6 7f 03 b7 2d 9f a5 2a 25 8e 65 d2 b9 |.V.....-..*%.e..|
22 | 00000140 6a f3 e4 7e 79 d7 3d cc b2 3d b6 24 a9 31 82 49 |j..~y.=..=.$.1.I|
23 | 00000150 38 16 92 f0 49 97 e2 07 e2 cd 1c 77 d3 e0 00 de |8...I......w....|
24 | 00000160 56 11 17 40 00 63 13 00 48 39 8e fd 09 96 08 f3 |V..@.c..H9......|
25 | 00000170 81 7c 00 00 00 00 00 31 30 a4 22 35 6e 4a 09 af |.|.....10."5nJ..|
26 | 00000180 08 22 97 92 e0 8a eb c0 e0 28 32 f4 8f ed 1e 02 |.".......(2.....|
27 | 00000190 a9 b3 43 de f3 04 cb 7b db 01 51 88 46 02 c1 4b |..C....{..Q.F..K|
28 | 000001a0 ec fa a8 05 42 a4 00 ae ed |....B....|
29 | >>> Flow 2 (server to client)
30 | 00000000 16 03 03 00 80 02 00 00 7c 03 03 00 00 00 00 00 |........|.......|
31 | 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
32 | 00000020 00 00 00 00 00 00 00 00 00 00 00 20 c0 df df c9 |........... ....|
33 | 00000030 1d ed 19 9e 2d ce 57 f6 95 54 67 76 77 64 c7 f4 |....-.W..Tgvwd..|
34 | 00000040 ad 18 7d d8 58 6f 08 30 a5 a4 50 cd 13 02 00 00 |..}.Xo.0..P.....|
35 | 00000050 34 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |4.+.....3.$... /|
36 | 00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0|
37 | 00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 00 |.........._X.;t.|
38 | 00000080 29 00 02 00 00 14 03 03 00 01 01 17 03 03 00 17 |)...............|
39 | 00000090 cc 35 3b 89 bc fe dc df 02 d3 00 f8 ef 56 74 6a |.5;..........Vtj|
40 | 000000a0 ee af 35 9e d6 91 e1 17 03 03 00 45 07 24 33 da |..5........E.$3.|
41 | 000000b0 63 9a eb 15 28 dc e8 60 dc 36 97 12 5e 54 a5 48 |c...(..`.6..^T.H|
42 | 000000c0 aa e3 07 35 e7 f0 7c 60 93 d4 4c 24 d7 0d 01 66 |...5..|`..L$...f|
43 | 000000d0 d9 b6 e3 c5 ab 9d cf 47 49 f6 4f 87 7a c4 ab 34 |.......GI.O.z..4|
44 | 000000e0 df 37 19 a6 f9 36 c8 ea 04 af 9a d7 21 dd 89 e2 |.7...6......!...|
45 | 000000f0 79 17 03 03 00 a3 60 8e 39 7e 5d 21 e2 e4 8a 0e |y.....`.9~]!....|
46 | 00000100 73 4a 96 09 49 fb 55 b4 68 60 88 0d 01 73 5b d0 |sJ..I.U.h`...s[.|
47 | 00000110 42 4d 9a af 22 ae 33 83 16 60 3e 25 e2 fd 76 10 |BM..".3..`>%..v.|
48 | 00000120 6e 92 0d 6b 88 c7 54 46 51 bf 86 a4 f4 11 d3 e8 |n..k..TFQ.......|
49 | 00000130 29 54 16 31 b2 44 4b 45 5d 3f 97 d9 33 10 ef 92 |)T.1.DKE]?..3...|
50 | 00000140 e5 aa 3b 2d 3d 36 ef 85 04 2d 17 66 2a 00 ea 87 |..;-=6...-.f*...|
51 | 00000150 9a 95 5e 54 1b 01 f8 5d 34 96 83 cf 28 d4 24 ed |..^T...]4...(.$.|
52 | 00000160 c6 9b da 7a 1c d4 a3 5a 53 bb 2f cf 56 f3 ef 99 |...z...ZS./.V...|
53 | 00000170 40 e2 34 31 ca 55 c9 7a 02 47 14 8b 7e 04 5a ff |@.41.U.z.G..~.Z.|
54 | 00000180 17 f7 95 f0 46 e0 ce cf 8f b0 9f 6b 51 96 d5 f7 |....F......kQ...|
55 | 00000190 0b 33 e2 0a 62 4e 05 28 66 |.3..bN.(f|
56 | >>> Flow 3 (client to server)
57 | 00000000 14 03 03 00 01 01 17 03 03 00 45 66 00 e2 3f 07 |..........Ef..?.|
58 | 00000010 02 a4 1d 71 27 2a fe c7 00 1e 2d bc 50 b6 bc 35 |...q'*....-.P..5|
59 | 00000020 22 c4 a4 d8 a1 5f fa 10 d7 48 c8 20 94 50 b1 ae |"...._...H. .P..|
60 | 00000030 47 8c 62 26 15 79 33 6b 06 0d 19 67 7e 22 7c a5 |G.b&.y3k...g~"|.|
61 | 00000040 ca 05 c9 ae c8 66 6b ca 8e f7 7c 35 de 5e c3 25 |.....fk...|5.^.%|
62 | >>> Flow 4 (server to client)
63 | 00000000 17 03 03 00 1e 6a 89 ce e3 1d 13 60 f3 8b 26 97 |.....j.....`..&.|
64 | 00000010 3e 5d 9f a8 47 c9 74 f5 66 ad 75 87 57 ec ef b1 |>]..G.t.f.u.W...|
65 | 00000020 66 da f0 17 03 03 00 13 95 bd 2d ef d5 30 c1 1b |f.........-..0..|
66 | 00000030 bd 54 3d f6 16 02 28 78 a4 4a 24 |.T=...(x.J$|
67 |
--------------------------------------------------------------------------------
/utls/testdata/example-cert.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIBhTCCASugAwIBAgIQIRi6zePL6mKjOipn+dNuaTAKBggqhkjOPQQDAjASMRAw
3 | DgYDVQQKEwdBY21lIENvMB4XDTE3MTAyMDE5NDMwNloXDTE4MTAyMDE5NDMwNlow
4 | EjEQMA4GA1UEChMHQWNtZSBDbzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABD0d
5 | 7VNhbWvZLWPuj/RtHFjvtJBEwOkhbN/BnnE8rnZR8+sbwnc/KhCk3FhnpHZnQz7B
6 | 5aETbbIgmuvewdjvSBSjYzBhMA4GA1UdDwEB/wQEAwICpDATBgNVHSUEDDAKBggr
7 | BgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MCkGA1UdEQQiMCCCDmxvY2FsaG9zdDo1
8 | NDUzgg4xMjcuMC4wLjE6NTQ1MzAKBggqhkjOPQQDAgNIADBFAiEA2zpJEPQyz6/l
9 | Wf86aX6PepsntZv2GYlA5UpabfT2EZICICpJ5h/iI+i341gBmLiAFQOyTDT+/wQc
10 | 6MF9+Yw1Yy0t
11 | -----END CERTIFICATE-----
12 |
--------------------------------------------------------------------------------
/utls/testdata/example-key.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN EC PRIVATE KEY-----
2 | MHcCAQEEIIrYSSNQFaA2Hwf1duRSxKtLYX5CB04fSeQ6tF1aY/PuoAoGCCqGSM49
3 | AwEHoUQDQgAEPR3tU2Fta9ktY+6P9G0cWO+0kETA6SFs38GecTyudlHz6xvCdz8q
4 | EKTcWGekdmdDPsHloRNtsiCa697B2O9IFA==
5 | -----END EC PRIVATE KEY-----
6 |
--------------------------------------------------------------------------------
/utls/testenv/testenv_cgo.go:
--------------------------------------------------------------------------------
1 | // Copyright 2017 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build cgo
6 |
7 | package testenv
8 |
9 | func init() {
10 | haveCGO = true
11 | }
12 |
--------------------------------------------------------------------------------
/utls/testenv/testenv_notwin.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | // +build !windows
6 |
7 | package testenv
8 |
9 | import (
10 | "runtime"
11 | )
12 |
13 | func hasSymlink() (ok bool, reason string) {
14 | switch runtime.GOOS {
15 | case "android", "nacl", "plan9":
16 | return false, ""
17 | }
18 |
19 | return true, ""
20 | }
21 |
--------------------------------------------------------------------------------
/utls/testenv/testenv_windows.go:
--------------------------------------------------------------------------------
1 | // Copyright 2016 The Go Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style
3 | // license that can be found in the LICENSE file.
4 |
5 | package testenv
6 |
7 | import (
8 | "io/ioutil"
9 | "os"
10 | "path/filepath"
11 | "sync"
12 | "syscall"
13 | )
14 |
15 | var symlinkOnce sync.Once
16 | var winSymlinkErr error
17 |
18 | func initWinHasSymlink() {
19 | tmpdir, err := ioutil.TempDir("", "symtest")
20 | if err != nil {
21 | panic("failed to create temp directory: " + err.Error())
22 | }
23 | defer os.RemoveAll(tmpdir)
24 |
25 | err = os.Symlink("target", filepath.Join(tmpdir, "symlink"))
26 | if err != nil {
27 | err = err.(*os.LinkError).Err
28 | switch err {
29 | case syscall.EWINDOWS, syscall.ERROR_PRIVILEGE_NOT_HELD:
30 | winSymlinkErr = err
31 | }
32 | }
33 | }
34 |
35 | func hasSymlink() (ok bool, reason string) {
36 | symlinkOnce.Do(initWinHasSymlink)
37 |
38 | switch winSymlinkErr {
39 | case nil:
40 | return true, ""
41 | case syscall.EWINDOWS:
42 | return false, ": symlinks are not supported on your version of Windows"
43 | case syscall.ERROR_PRIVILEGE_NOT_HELD:
44 | return false, ": you don't have enough privileges to create symlinks"
45 | }
46 |
47 | return false, ""
48 | }
49 |
--------------------------------------------------------------------------------
/utls/u_prng.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019, Psiphon Inc.
3 | * All rights reserved.
4 | *
5 | * Released under utls licence:
6 | * https://github.com/refraction-networking/utls/blob/master/LICENSE
7 | */
8 |
9 | // This code is a pared down version of:
10 | // https://github.com/Psiphon-Labs/psiphon-tunnel-core/blob/158caea562287284cc3fa5fcd1b3c97b1addf659/psiphon/common/prng/prng.go
11 |
12 | package tls
13 |
14 | import (
15 | crypto_rand "crypto/rand"
16 | "encoding/binary"
17 | "io"
18 | "math"
19 | "math/rand"
20 | "sync"
21 |
22 | "golang.org/x/crypto/sha3"
23 | )
24 |
25 | const (
26 | PRNGSeedLength = 32
27 | )
28 |
29 | // PRNGSeed is a PRNG seed.
30 | type PRNGSeed [PRNGSeedLength]byte
31 |
32 | // NewPRNGSeed creates a new PRNG seed using crypto/rand.Read.
33 | func NewPRNGSeed() (*PRNGSeed, error) {
34 | seed := new(PRNGSeed)
35 | _, err := crypto_rand.Read(seed[:])
36 | if err != nil {
37 | return nil, err
38 | }
39 | return seed, nil
40 | }
41 |
42 | // prng is a seeded, unbiased PRNG based on SHAKE256 that is suitable for use
43 | // cases such as obfuscation.
44 | //
45 | // Seeding is based on crypto/rand.Read.
46 | //
47 | // This PRNG is _not_ for security use cases including production cryptographic
48 | // key generation.
49 | //
50 | // It is safe to make concurrent calls to a PRNG instance.
51 | //
52 | // PRNG conforms to io.Reader and math/rand.Source, with additional helper
53 | // functions.
54 | type prng struct {
55 | sync.Mutex
56 |
57 | r io.Reader
58 | rand *rand.Rand
59 | }
60 |
61 | // newPRNG generates a seed and creates a PRNG with that seed.
62 | func newPRNG() (*prng, error) {
63 | seed, err := NewPRNGSeed()
64 | if err != nil {
65 | return nil, err
66 | }
67 | return newPRNGWithSeed(seed), nil
68 | }
69 |
70 | // newPRNGWithSeed initializes a new PRNG using an existing seed.
71 | func newPRNGWithSeed(seed *PRNGSeed) *prng {
72 | h := sha3.NewShake256()
73 | _, _ = h.Write(seed[:])
74 |
75 | p := &prng{
76 | r: h,
77 | }
78 | p.rand = rand.New(p)
79 | return p
80 | }
81 |
82 | // Read reads random bytes from the PRNG stream into b. Read conforms to
83 | // io.Reader and always returns len(p), nil.
84 | func (p *prng) Read(b []byte) (int, error) {
85 | p.Lock()
86 | defer p.Unlock()
87 |
88 | return io.ReadFull(p.r, b)
89 | }
90 |
91 | // Int63 is equivilent to math/read.Int63.
92 | func (p *prng) Int63() int64 {
93 | i := p.Uint64()
94 | return int64(i & (1<<63 - 1))
95 | }
96 |
97 | // Int63 is equivilent to math/read.Uint64.
98 | func (p *prng) Uint64() uint64 {
99 | var b [8]byte
100 | p.Read(b[:])
101 | return binary.BigEndian.Uint64(b[:])
102 | }
103 |
104 | // Seed must exist in order to use a PRNG as a math/rand.Source. This call is
105 | // not supported and ignored.
106 | func (p *prng) Seed(_ int64) {
107 | }
108 |
109 | // FlipWeightedCoin returns the result of a weighted
110 | // random coin flip. If the weight is 0.5, the outcome
111 | // is equally likely to be true or false. If the weight
112 | // is 1.0, the outcome is always true, and if the
113 | // weight is 0.0, the outcome is always false.
114 | //
115 | // Input weights > 1.0 are treated as 1.0.
116 | func (p *prng) FlipWeightedCoin(weight float64) bool {
117 | if weight > 1.0 {
118 | weight = 1.0
119 | }
120 | f := float64(p.Int63()) / float64(math.MaxInt64)
121 | return f > 1.0-weight
122 | }
123 |
124 | // Intn is equivilent to math/read.Intn, except it returns 0 if n <= 0
125 | // instead of panicking.
126 | func (p *prng) Intn(n int) int {
127 | if n <= 0 {
128 | return 0
129 | }
130 | return p.rand.Intn(n)
131 | }
132 |
133 | // Int63n is equivilent to math/read.Int63n, except it returns 0 if n <= 0
134 | // instead of panicking.
135 | func (p *prng) Int63n(n int64) int64 {
136 | if n <= 0 {
137 | return 0
138 | }
139 | return p.rand.Int63n(n)
140 | }
141 |
142 | // Intn is equivilent to math/read.Perm.
143 | func (p *prng) Perm(n int) []int {
144 | return p.rand.Perm(n)
145 | }
146 |
147 | // Range selects a random integer in [min, max].
148 | // If min < 0, min is set to 0. If max < min, min is returned.
149 | func (p *prng) Range(min, max int) int {
150 | if min < 0 {
151 | min = 0
152 | }
153 | if max < min {
154 | return min
155 | }
156 | n := p.Intn(max - min + 1)
157 | n += min
158 | return n
159 | }
160 |
--------------------------------------------------------------------------------
/utls/u_roller.go:
--------------------------------------------------------------------------------
1 | package tls
2 |
3 | import (
4 | "net"
5 | "sync"
6 | "time"
7 | )
8 |
9 | type Roller struct {
10 | HelloIDs []ClientHelloID
11 | HelloIDMu sync.Mutex
12 | WorkingHelloID *ClientHelloID
13 | TcpDialTimeout time.Duration
14 | TlsHandshakeTimeout time.Duration
15 | r *prng
16 | }
17 |
18 | // NewRoller creates Roller object with default range of HelloIDs to cycle through until a
19 | // working/unblocked one is found.
20 | func NewRoller() (*Roller, error) {
21 | r, err := newPRNG()
22 | if err != nil {
23 | return nil, err
24 | }
25 |
26 | tcpDialTimeoutInc := r.Intn(14)
27 | tcpDialTimeoutInc = 7 + tcpDialTimeoutInc
28 |
29 | tlsHandshakeTimeoutInc := r.Intn(20)
30 | tlsHandshakeTimeoutInc = 11 + tlsHandshakeTimeoutInc
31 |
32 | return &Roller{
33 | HelloIDs: []ClientHelloID{
34 | HelloChrome_Auto,
35 | HelloFirefox_Auto,
36 | HelloIOS_Auto,
37 | HelloRandomized,
38 | },
39 | TcpDialTimeout: time.Second * time.Duration(tcpDialTimeoutInc),
40 | TlsHandshakeTimeout: time.Second * time.Duration(tlsHandshakeTimeoutInc),
41 | r: r,
42 | }, nil
43 | }
44 |
45 | // Dial attempts to establish connection to given address using different HelloIDs.
46 | // If a working HelloID is found, it is used again for subsequent Dials.
47 | // If tcp connection fails or all HelloIDs are tried, returns with last error.
48 | //
49 | // Usage examples:
50 | // Dial("tcp4", "google.com:443", "google.com")
51 | // Dial("tcp", "10.23.144.22:443", "mywebserver.org")
52 | func (c *Roller) Dial(network, addr, serverName string) (*UConn, error) {
53 | helloIDs := make([]ClientHelloID, len(c.HelloIDs))
54 | copy(helloIDs, c.HelloIDs)
55 | c.r.rand.Shuffle(len(c.HelloIDs), func(i, j int) {
56 | helloIDs[i], helloIDs[j] = helloIDs[j], helloIDs[i]
57 | })
58 |
59 | c.HelloIDMu.Lock()
60 | workingHelloId := c.WorkingHelloID // keep using same helloID, if it works
61 | c.HelloIDMu.Unlock()
62 | if workingHelloId != nil {
63 | helloIDFound := false
64 | for i, ID := range helloIDs {
65 | if ID == *workingHelloId {
66 | helloIDs[i] = helloIDs[0]
67 | helloIDs[0] = *workingHelloId // push working hello ID first
68 | helloIDFound = true
69 | break
70 | }
71 | }
72 | if !helloIDFound {
73 | helloIDs = append([]ClientHelloID{*workingHelloId}, helloIDs...)
74 | }
75 | }
76 |
77 | var tcpConn net.Conn
78 | var err error
79 | for _, helloID := range helloIDs {
80 | tcpConn, err = net.DialTimeout(network, addr, c.TcpDialTimeout)
81 | if err != nil {
82 | return nil, err // on tcp Dial failure return with error right away
83 | }
84 |
85 | client := UClient(tcpConn, nil, helloID)
86 | client.SetSNI(serverName)
87 | client.SetDeadline(time.Now().Add(c.TlsHandshakeTimeout))
88 | err = client.Handshake()
89 | client.SetDeadline(time.Time{}) // unset timeout
90 | if err != nil {
91 | continue // on tls Dial error keep trying HelloIDs
92 | }
93 |
94 | c.HelloIDMu.Lock()
95 | c.WorkingHelloID = &client.ClientHelloID
96 | c.HelloIDMu.Unlock()
97 | return client, err
98 | }
99 | return nil, err
100 | }
101 |
--------------------------------------------------------------------------------
/utls/y_certificate_compression.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 Yawning Angel
2 | //
3 | // This program is free software: you can redistribute it and/or modify
4 | // it under the terms of the GNU General Public License as published by
5 | // the Free Software Foundation, either version 3 of the License, or
6 | // (at your option) any later version.
7 | //
8 | // This program is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU General Public License
14 | // along with this program. If not, see .
15 |
16 | package tls
17 |
18 | import (
19 | "bytes"
20 | "compress/zlib"
21 | "errors"
22 | "fmt"
23 | "io"
24 |
25 | "github.com/dsnet/compress/brotli"
26 | "golang.org/x/crypto/cryptobyte"
27 | )
28 |
29 | const (
30 | // TEMPORARY: draft-ietf-tls-certificate-compression-04
31 | typeCompressedCertificate uint8 = 25
32 | extensionCompressCertificate uint16 = 27
33 | )
34 |
35 | type CompressCertificateExtension struct {
36 | Algorithms []CertCompressionAlgo
37 | }
38 |
39 | func (e *CompressCertificateExtension) writeToUConn(uc *UConn) error {
40 | uc.extCompressCerts = true
41 | return nil
42 | }
43 |
44 | func (e *CompressCertificateExtension) Len() int {
45 | return 4 + 1 + (2 * len(e.Algorithms))
46 | }
47 |
48 | func (e *CompressCertificateExtension) Read(b []byte) (int, error) {
49 | if len(b) < e.Len() {
50 | return 0, io.ErrShortBuffer
51 | }
52 | extLen := 2 * len(e.Algorithms)
53 | if extLen > 255 {
54 | return 0, errors.New("too many supported algorithms")
55 | }
56 |
57 | b[0] = byte(extensionCompressCertificate >> 8)
58 | b[1] = byte(extensionCompressCertificate)
59 | b[2] = byte((extLen + 1) >> 8)
60 | b[3] = byte((extLen + 1))
61 | b[4] = byte(extLen)
62 |
63 | i := 5
64 | for _, alg := range e.Algorithms {
65 | b[i] = byte(alg >> 8)
66 | b[i+1] = byte(alg)
67 | i += 2
68 | }
69 | return e.Len(), io.EOF
70 | }
71 |
72 | type compressedCertificateMsg struct {
73 | raw []byte
74 |
75 | algorithm CertCompressionAlgo
76 | uncompressedLength uint32
77 | compressedCertificateMessage []byte
78 | }
79 |
80 | func (m *compressedCertificateMsg) marshal() []byte {
81 | if m.raw != nil {
82 | return m.raw
83 | }
84 |
85 | panic("utls: compressedCertificateMsg.marshal() not actually implemented")
86 | }
87 |
88 | func (m *compressedCertificateMsg) unmarshal(data []byte) bool {
89 | m.raw = append([]byte{}, data...)
90 |
91 | s := cryptobyte.String(data[4:])
92 |
93 | var algID uint16
94 | if !s.ReadUint16(&algID) {
95 | return false
96 | }
97 | if !s.ReadUint24(&m.uncompressedLength) {
98 | return false
99 | }
100 | if !readUint24LengthPrefixed(&s, &m.compressedCertificateMessage) {
101 | return false
102 | }
103 | m.algorithm = CertCompressionAlgo(algID)
104 |
105 | return true
106 | }
107 |
108 | func (m *compressedCertificateMsg) toCertificateMsg() (*certificateMsgTLS13, error) {
109 | var (
110 | decompressed []byte
111 | rd io.ReadCloser
112 | err error
113 | )
114 |
115 | if m.uncompressedLength > 1<<24 {
116 | return nil, fmt.Errorf("utls: oversized decompressed certificate length")
117 | }
118 |
119 | compressed := bytes.NewBuffer(m.compressedCertificateMessage)
120 | switch m.algorithm {
121 | case CertCompressionZlib:
122 | rd, err = zlib.NewReader(compressed)
123 | case CertCompressionBrotli:
124 | rd, err = brotli.NewReader(compressed, nil)
125 | default:
126 | return nil, fmt.Errorf("utls: unknown certificate compression algorithm: %v", m.algorithm)
127 | }
128 | if err != nil {
129 | return nil, err
130 | }
131 | defer rd.Close()
132 |
133 | decompressed = make([]byte, m.uncompressedLength)
134 | if _, err = io.ReadFull(rd, decompressed); err != nil {
135 | return nil, err
136 | }
137 |
138 | // Enforce the length just to be sure.
139 | length := len(decompressed)
140 | if length != int(m.uncompressedLength) {
141 | return nil, fmt.Errorf("utls: invalid decompressed certificate length: %v", length)
142 | }
143 |
144 | // Prepend the type and record length to the synthetic Certificate message.
145 | // Technically this can be 4 bytes of 0x00 since nothing examines it, but
146 | // being correct doesn't hurt.
147 | decompressed = append([]byte{
148 | typeCertificate,
149 | byte(length >> 16),
150 | byte(length >> 8),
151 | byte(length),
152 | }, decompressed...)
153 |
154 | var mm certificateMsgTLS13
155 | if !mm.unmarshal(decompressed) {
156 | return nil, fmt.Errorf("utls: failed to unmarshal decompressed certificateMsgTLS13")
157 | }
158 |
159 | return &mm, nil
160 | }
161 |
--------------------------------------------------------------------------------
/utls/y_ctaes.go:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019 Yawning Angel
2 | //
3 | // This program is free software: you can redistribute it and/or modify
4 | // it under the terms of the GNU General Public License as published by
5 | // the Free Software Foundation, either version 3 of the License, or
6 | // (at your option) any later version.
7 | //
8 | // This program is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU General Public License
14 | // along with this program. If not, see .
15 |
16 | package tls
17 |
18 | import (
19 | "crypto/aes"
20 | "crypto/cipher"
21 |
22 | "gitlab.com/yawning/bsaes.git"
23 | )
24 |
25 | var aesNewCipher func([]byte) (cipher.Block, error)
26 |
27 | // EnableVartimeAES allows utls connections to the faster but insecure
28 | // AES and GHASH implementation on certain hardware configurations. When
29 | // running on devices where the runtime `crypto/aes` implementation is
30 | // constant time, this option has no effect.
31 | func EnableVartimeAES() {
32 | aesNewCipher = aes.NewCipher
33 | }
34 |
35 | func init() {
36 | // Platforms where the runtime has optimized GCM-AES are the only
37 | // platforms where it is actually safe to use `crypto/aes` if you
38 | // care about cache timing attacks.
39 | //
40 | // Note: `s390x` may also be safe from skimming the Go source, but
41 | // upstream utls apparently had trouble getting it to work correctly.
42 | if hasGCMAsm {
43 | aesNewCipher = aes.NewCipher
44 | } else {
45 | aesNewCipher = bsaes.NewCipher
46 | }
47 | }
48 |
--------------------------------------------------------------------------------