Ai
1 Star 0 Fork 1

可乐烛光烟/go-utils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
request.go 540 Bytes
一键复制 编辑 原始数据 按行查看 历史
可乐烛光烟 提交于 2022-11-09 00:21 +08:00 . Initial commit
/**
* @Author rysa
* @Time 2021/2/27 下午2:26
* @Project go-utils
* @Desc
*/
package request
import (
"crypto/tls"
"github.com/go-resty/resty/v2"
)
type CertConfig struct {
CertFile, KeyFile string
}
func NewRequest() *resty.Request {
r := resty.New()
return r.R()
}
/**
* @Description: 使用密匙访问
* @param data
* @return *resty.Request
*/
func NewCertRequest(data CertConfig) *resty.Request {
r := resty.New()
cert, _ := tls.LoadX509KeyPair(data.CertFile, data.KeyFile)
r.SetCertificates(cert)
return r.R()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/rysa/go-utils.git
git@gitee.com:rysa/go-utils.git
rysa
go-utils
go-utils
v1.1.0

搜索帮助