-
Notifications
You must be signed in to change notification settings - Fork 5
/
bypass.go
34 lines (29 loc) Β· 889 Bytes
/
bypass.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package binglib
import (
"bytes"
"encoding/json"
"net/http"
"github.com/Harry-zklcdc/bing-lib/lib/request"
)
func Bypass(bypassServer, cookie, iframeid, IG, convId, rid, T, Host string) (passResp PassResponseStruct, status int, err error) {
passRequest := passRequestStruct{
Cookies: cookie,
Iframeid: iframeid,
IG: IG,
ConvId: convId,
RId: rid,
T: T,
Host: Host,
}
passResq, err := json.Marshal(passRequest)
if err != nil {
return passResp, http.StatusInternalServerError, err
}
c := request.NewRequest()
c.SetMethod("POST").SetUrl(bypassServer).SetBody(bytes.NewReader(passResq)).SetHeader("Content-Type", "application/json").SetHeader("User-Agent", userAgent).Do()
err = json.Unmarshal(c.Result.Body, &passResp)
if err != nil {
return passResp, http.StatusInternalServerError, err
}
return passResp, c.Result.Status, nil
}