Commit 21bcf2d0 authored by wangmingming's avatar wangmingming

11

parent a7024b19
...@@ -13,11 +13,12 @@ import ( ...@@ -13,11 +13,12 @@ import (
) )
type Client struct { type Client struct {
Client tls_client.HttpClient Client tls_client.HttpClient
Jar tls_client.CookieJar Jar tls_client.CookieJar
Item ForwardItem Item ForwardItem
Response *http.Response Response *http.Response
uri *url.URL uri *url.URL
TlsVersion string
} }
func (c *Client) Start() error { func (c *Client) Start() error {
...@@ -127,10 +128,10 @@ func RandRandom(a int64) int64 { ...@@ -127,10 +128,10 @@ func RandRandom(a int64) int64 {
} }
func NewClient(forWard ForwardItem) (Client, error) { func NewClient(forWard ForwardItem) (Client, error) {
jar := tls_client.NewCookieJar() jar := tls_client.NewCookieJar()
tlsVersion := chromes[RandRandom(int64(len(chromes)))]
options := []tls_client.HttpClientOption{ options := []tls_client.HttpClientOption{
tls_client.WithTimeoutSeconds(forWard.Timeout), tls_client.WithTimeoutSeconds(forWard.Timeout),
tls_client.WithClientProfile(chromes[RandRandom(int64(len(chromes)))]), tls_client.WithClientProfile(tlsVersion),
tls_client.WithProxyUrl(forWard.Proxy), tls_client.WithProxyUrl(forWard.Proxy),
//tls_client.WithForceHttp1(), //tls_client.WithForceHttp1(),
tls_client.WithCookieJar(jar), tls_client.WithCookieJar(jar),
...@@ -143,5 +144,5 @@ func NewClient(forWard ForwardItem) (Client, error) { ...@@ -143,5 +144,5 @@ func NewClient(forWard ForwardItem) (Client, error) {
if err != nil { if err != nil {
return Client{}, err return Client{}, err
} }
return Client{Client: client, Item: forWard, Jar: jar}, nil return Client{Client: client, Item: forWard, Jar: jar, TlsVersion: tlsVersion.GetClientHelloStr()}, nil
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment