Commit 6ee9a569 authored by wang's avatar wang

cronet

parent ea8525b9
......@@ -5,6 +5,7 @@ import (
"compress/flate"
"compress/gzip"
"crypto/rand"
"encoding/base64"
"encoding/binary"
"errors"
"github.com/andybalholm/brotli"
......@@ -69,7 +70,16 @@ func (c *Client) Start() error {
} else if strings.ToUpper(c.Item.Method) == http.MethodOptions {
req, err = http.NewRequest(http.MethodOptions, c.Item.Url, nil)
} else {
req, err = http.NewRequest(http.MethodPost, c.Item.Url, strings.NewReader(c.Item.Data))
if c.Item.IsBinary {
bys, err := base64.StdEncoding.DecodeString(c.Item.Data)
if err != nil {
return err
}
req, err = http.NewRequest(http.MethodPost, c.Item.Url, bytes.NewReader(bys))
} else {
req, err = http.NewRequest(http.MethodPost, c.Item.Url, strings.NewReader(c.Item.Data))
}
}
if err != nil {
logrus.Error("url初始化失败 ", err.Error())
......
......@@ -18,6 +18,7 @@ type ForwardItem struct {
Verify bool `json:"verify,omitempty"`
Debug bool `json:"debug"`
RandomTls bool `json:"random_tls"`
IsBinary bool `json:"is_binary"`
}
func ForwardIOS(c *gin.Context) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment