improve: 请求中的 _ 与 callback 更像真实值
This commit is contained in:
2
go.mod
2
go.mod
@@ -3,7 +3,7 @@ module github.com/Mmx233/BitSrunLoginGo
|
||||
go 1.21.4
|
||||
|
||||
require (
|
||||
github.com/Mmx233/tool v0.7.3
|
||||
github.com/Mmx233/tool v0.7.4
|
||||
github.com/antonfisher/nested-logrus-formatter v1.3.1
|
||||
github.com/cloudflare/cloudflare-go v0.82.0
|
||||
github.com/mitchellh/mapstructure v1.5.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1,5 +1,5 @@
|
||||
github.com/Mmx233/tool v0.7.3 h1:a9uB8Fd7qE+sKck0lH8ZKNyc1vkb3rasXD0WUM5nuVA=
|
||||
github.com/Mmx233/tool v0.7.3/go.mod h1:pCKnFmN2yf3u58YjANsQ8261SxI/c8/0wiZhptjRsOk=
|
||||
github.com/Mmx233/tool v0.7.4 h1:fFmzMGR4nKdbXijmPbyi0GcAFYsicf9lvuCllPdmnZE=
|
||||
github.com/Mmx233/tool v0.7.4/go.mod h1:tEQN6qc2s/sOJKcxr06SktzZ2fCuwdOs0fK01UTfe4Q=
|
||||
github.com/antonfisher/nested-logrus-formatter v1.3.1 h1:NFJIr+pzwv5QLHTPyKz9UMEoHck02Q9L0FP13b/xSbQ=
|
||||
github.com/antonfisher/nested-logrus-formatter v1.3.1/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA=
|
||||
github.com/cloudflare/cloudflare-go v0.82.0 h1:t4G5BcutMcd+3U1FJHifo7Gv3m3LCzhARKZDinSi9Qs=
|
||||
|
||||
@@ -44,13 +44,11 @@ func (a DnsProvider) SendRequest(Type, Action string, data map[string]interface{
|
||||
var reqOpt = tool.DoHttpReq{
|
||||
Url: "https://alidns.aliyuncs.com",
|
||||
}
|
||||
randSource := rand.NewSource(time.Now().UnixNano())
|
||||
randRand := rand.New(randSource)
|
||||
data["Format"] = "json"
|
||||
data["Version"] = "2015-01-09"
|
||||
data["SignatureMethod"] = "HMAC-SHA1"
|
||||
data["SignatureVersion"] = "1.0"
|
||||
data["SignatureNonce"] = fmt.Sprint(tool.RandNum(randRand, 10000000, 90000000))
|
||||
data["SignatureNonce"] = fmt.Sprint(tool.NewRand(rand.NewSource(time.Now().UnixNano())).Num(10000000, 90000000))
|
||||
data["Timestamp"] = time.Now().UTC().Format("2006-01-02T15:04:05Z")
|
||||
data["Action"] = Action
|
||||
data["AccessKeyId"] = a.AccessKeyId
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/Mmx233/tool"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"io"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
@@ -48,13 +49,12 @@ func (a *Api) Init(conf *ApiConfig) {
|
||||
|
||||
func (a *Api) request(path string, query map[string]interface{}) (map[string]interface{}, error) {
|
||||
log.Debugln("HTTP GET ", a.BaseUrl+path)
|
||||
timestamp := fmt.Sprint(time.Now().UnixNano())
|
||||
callback := "jQuery" + timestamp
|
||||
callback := fmt.Sprintf("jQuery%s_%d", tool.NewRand(rand.NewSource(time.Now().UnixNano())).WithLetters("123456789").String(21), time.Now().UnixMilli())
|
||||
if query == nil {
|
||||
query = make(map[string]interface{}, 2)
|
||||
}
|
||||
query["callback"] = callback
|
||||
query["_"] = timestamp
|
||||
query["_"] = fmt.Sprint(time.Now().UnixMilli())
|
||||
httpTool := tool.NewHttpTool(a.Client)
|
||||
req, err := httpTool.GenReq("GET", &tool.DoHttpReq{
|
||||
Url: a.BaseUrl + path,
|
||||
|
||||
Reference in New Issue
Block a user