Commit d1dd4f2b authored by 王明明's avatar 王明明

超时处理

parent d8fe0a64
...@@ -66,7 +66,7 @@ func (c *AkmClient) PostJson(times int, url, data string) (int, error) { ...@@ -66,7 +66,7 @@ func (c *AkmClient) PostJson(times int, url, data string) (int, error) {
"user-agent", "user-agent",
}, },
} }
for i := 0; i < 3; i++ { for i := 0; i < 1; i++ {
startTime := time.Now() startTime := time.Now()
response, err := c.Client.Do(req) response, err := c.Client.Do(req)
if err != nil { if err != nil {
......
...@@ -5,7 +5,6 @@ import ( ...@@ -5,7 +5,6 @@ import (
"fmt" "fmt"
http "github.com/bogdanfinn/fhttp" http "github.com/bogdanfinn/fhttp"
tls_client "github.com/bogdanfinn/tls-client" tls_client "github.com/bogdanfinn/tls-client"
"io"
"io/ioutil" "io/ioutil"
"net/url" "net/url"
"strings" "strings"
...@@ -25,8 +24,8 @@ func query(data []byte) { ...@@ -25,8 +24,8 @@ func query(data []byte) {
tls_client.WithClientProfile(tls_client.Chrome_110), tls_client.WithClientProfile(tls_client.Chrome_110),
tls_client.WithNotFollowRedirects(), tls_client.WithNotFollowRedirects(),
tls_client.WithCookieJar(jar), // create cookieJar instance and pass it as argument tls_client.WithCookieJar(jar), // create cookieJar instance and pass it as argument
//tls_client.WithProxyUrl("http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600"), tls_client.WithProxyUrl("http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600"),
tls_client.WithProxyUrl("http://127.0.0.1:8888"), //tls_client.WithProxyUrl("http://127.0.0.1:8888"),
tls_client.WithInsecureSkipVerify(), tls_client.WithInsecureSkipVerify(),
} }
uri, _ := url.Parse("https://www.easyjet.com/") uri, _ := url.Parse("https://www.easyjet.com/")
...@@ -60,8 +59,8 @@ func query(data []byte) { ...@@ -60,8 +59,8 @@ func query(data []byte) {
} }
defer resp.Body.Close() defer resp.Body.Close()
fmt.Println("响应结果", resp.StatusCode) fmt.Println("响应结果", resp.StatusCode)
readBytes, _ := io.ReadAll(resp.Body) //readBytes, _ := io.ReadAll(resp.Body)
fmt.Println(string(readBytes)) //fmt.Println(string(readBytes))
} }
func main() { func main() {
...@@ -69,7 +68,7 @@ func main() { ...@@ -69,7 +68,7 @@ func main() {
t1 := time.Now() t1 := time.Now()
fmt.Println(t1) fmt.Println(t1)
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
for i := 0; i < 1; i++ { for i := 0; i < 10; i++ {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
...@@ -78,7 +77,7 @@ func main() { ...@@ -78,7 +77,7 @@ func main() {
//resp, err := http.Get("http://127.0.0.1:9999/ping") //resp, err := http.Get("http://127.0.0.1:9999/ping")
//resp, err := http.Post("http://lcc.unififi.com/proxy/get-proxy", "application/json", strings.NewReader("{\n \"name\": \"NK\",\n \"type\": \"shopping\"\n}")) //resp, err := http.Post("http://lcc.unififi.com/proxy/get-proxy", "application/json", strings.NewReader("{\n \"name\": \"NK\",\n \"type\": \"shopping\"\n}"))
t1 := time.Now() t1 := time.Now()
resp, err := http.Post("http://127.0.0.1:19999/akamai/gen", "application/json", strings.NewReader("{\"type\": \"u2\", \"proxy\": \"http://127.0.0.1:8888\"}")) resp, err := http.Post("http://127.0.0.1:19999/akamai/gen", "application/json", strings.NewReader("{\"type\": \"u2\", \"proxy\": \"http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600\"}"))
if err != nil { if err != nil {
//panic(err) //panic(err)
fmt.Println(err) fmt.Println(err)
......
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