Commit a7024b19 authored by wangmingming's avatar wangmingming

11

parent 4771cd35
package tls package tls
import ( import (
"crypto/rand"
"errors" "errors"
http "github.com/bogdanfinn/fhttp" http "github.com/bogdanfinn/fhttp"
tls_client "github.com/bogdanfinn/tls-client" tls_client "github.com/bogdanfinn/tls-client"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"io" "io"
"math/big"
"net/url" "net/url"
"strings" "strings"
) )
...@@ -107,12 +109,28 @@ func (c *Client) GetStatusCode() int { ...@@ -107,12 +109,28 @@ func (c *Client) GetStatusCode() int {
} }
var chromes = []tls_client.ClientProfile{
tls_client.Chrome_110,
tls_client.Chrome_107,
tls_client.Chrome_108,
tls_client.Chrome_109,
tls_client.Chrome_112,
tls_client.Chrome_111,
//tls_client.Safari_15_6_1,
//tls_client.Safari_16_0,
//tls_client.Safari_Ipad_15_6,
}
func RandRandom(a int64) int64 {
res, _ := rand.Int(rand.Reader, big.NewInt(a))
return res.Int64()
}
func NewClient(forWard ForwardItem) (Client, error) { func NewClient(forWard ForwardItem) (Client, error) {
jar := tls_client.NewCookieJar() jar := tls_client.NewCookieJar()
options := []tls_client.HttpClientOption{ options := []tls_client.HttpClientOption{
tls_client.WithTimeoutSeconds(forWard.Timeout), tls_client.WithTimeoutSeconds(forWard.Timeout),
tls_client.WithClientProfile(tls_client.Chrome_110), tls_client.WithClientProfile(chromes[RandRandom(int64(len(chromes)))]),
tls_client.WithProxyUrl(forWard.Proxy), tls_client.WithProxyUrl(forWard.Proxy),
//tls_client.WithForceHttp1(), //tls_client.WithForceHttp1(),
tls_client.WithCookieJar(jar), tls_client.WithCookieJar(jar),
......
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