From 4ac9614af682e9edec7205d42aa4ad9cc95835de Mon Sep 17 00:00:00 2001 From: timerzz Date: Wed, 20 Nov 2024 21:11:19 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=9D=83=E9=99=90=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/coach-client/client_cn_test.go | 2 +- pkg/coach-client/client_us.go | 9 ++++++++- pkg/coach-client/client_us_test.go | 2 +- pkg/restry-pool/resty.go | 14 ++++++++++++-- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/pkg/coach-client/client_cn_test.go b/pkg/coach-client/client_cn_test.go index 7a75eed..71cf67b 100644 --- a/pkg/coach-client/client_cn_test.go +++ b/pkg/coach-client/client_cn_test.go @@ -6,7 +6,7 @@ import ( ) func TestCNClient(t *testing.T) { - cli, err := CNClient() + cli, err := CNClient(XMac_Coach) if err != nil { t.Fatal(err) } diff --git a/pkg/coach-client/client_us.go b/pkg/coach-client/client_us.go index f36e210..50f2ca5 100644 --- a/pkg/coach-client/client_us.go +++ b/pkg/coach-client/client_us.go @@ -110,7 +110,14 @@ type ProductData struct { } `json:"prices"` Remark string `json:"-"` } - +type ImageGroup struct { + Images []struct { + Src string `json:"src"` + Title string `json:"title"` + Alt string `json:"alt"` + } `json:"images"` + ViewType string `json:"viewType"` +} type ProductDataResponse struct { ProductData []*ProductData `json:"productsData"` } diff --git a/pkg/coach-client/client_us_test.go b/pkg/coach-client/client_us_test.go index 3ff3e93..dd792c7 100644 --- a/pkg/coach-client/client_us_test.go +++ b/pkg/coach-client/client_us_test.go @@ -7,7 +7,7 @@ import ( ) func TestClient(t *testing.T) { - subs := []string{"https://us.timerzz.com:26106/vmess/sub", "https://us.timerzz.com:26106/trojan/sub", "https://us.timerzz.com:26106/ssr/sub"} + subs := []string{"https://us.timerzz.com:26106/vmess/sub"} pool := proxy.NewProxyPool(subs) client := USClient(pool) resp, err := client.ViewAllBags(context.Background(), 1) diff --git a/pkg/restry-pool/resty.go b/pkg/restry-pool/resty.go index 5a5d4e5..a1d5af1 100644 --- a/pkg/restry-pool/resty.go +++ b/pkg/restry-pool/resty.go @@ -2,12 +2,13 @@ package restry_pool import ( "context" - "github.com/corpix/uarand" - "github.com/go-resty/resty/v2" "net" "net/http" "sync" "time" + + "github.com/corpix/uarand" + "github.com/go-resty/resty/v2" ) var rp *restyPool @@ -35,6 +36,15 @@ const ( func beforeRequest(cli *resty.Client, req *resty.Request) error { cli.SetHeader("User-Agent", uarand.GetRandom()) + cli.SetHeader("sec-fetch-site", "same-origin") + cli.SetHeader("upgrade-insecure-requests", "1") + cli.SetHeaders(map[string]string{ + "sec-fetch-dest": "empty", + "sec-fetch-mode": "navigate", + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate, br", + "Connection": "keep-alive", + }) return nil } func NewRestyPool() *restyPool {