fix 修复请求没有权限的问题

This commit is contained in:
timerzz 2024-11-20 21:11:19 +08:00
parent 566d95bc0f
commit 4ac9614af6
4 changed files with 22 additions and 5 deletions

View File

@ -6,7 +6,7 @@ import (
)
func TestCNClient(t *testing.T) {
cli, err := CNClient()
cli, err := CNClient(XMac_Coach)
if err != nil {
t.Fatal(err)
}

View File

@ -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"`
}

View File

@ -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)

View File

@ -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 {