update docker deploy

This commit is contained in:
mubai
2023-07-13 23:49:08 +08:00
parent c4ecdde7f6
commit e111963ffd
37 changed files with 968 additions and 419 deletions

View File

@@ -19,7 +19,7 @@ var (
// RequestInfo 请求参数结构体
type RequestInfo struct {
Uri string `json:"uri"` // 请求url地址
Params url.Values `json:"params"` // 请求参数
Params url.Values `json:"param"` // 请求参数
Header http.Header `json:"header"` // 请求头数据
Resp []byte `json:"resp"` // 响应结果数据
}
@@ -30,6 +30,10 @@ var RefererUrl string
// CreateClient 初始化请求客户端
func CreateClient() *colly.Collector {
c := colly.NewCollector()
// 设置请求使用clash的socks5代理
//setProxy(c)
// 设置代理信息
//if proxy, err := proxy.RoundRobinProxySwitcher("127.0.0.1:7890"); err != nil {
// c.SetProxyFunc(proxy)
@@ -46,6 +50,7 @@ func CreateClient() *colly.Collector {
c.OnRequest(func(request *colly.Request) {
// 设置一些请求头信息
request.Headers.Set("Content-Type", "application/json;charset=UTF-8")
request.Headers.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36")
//request.Headers.Set("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7")
// 请求完成后设置请求头Referer
if len(RefererUrl) <= 0 || !strings.Contains(RefererUrl, request.URL.Host) {
@@ -89,3 +94,9 @@ func ApiGet(r *RequestInfo) {
log.Println("获取数据失败: ", err)
}
}
// 本地代理测试
func setProxy(c *colly.Collector) {
proxyUrl, _ := url.Parse("socks5://127.0.0.1:7890")
c.WithTransport(&http.Transport{Proxy: http.ProxyURL(proxyUrl)})
}