3 Star 6 Fork 0

Gitee 极速下载/bombardier

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/codesenberg/bombardier
克隆/下载
client_cert.go 911 Bytes
一键复制 编辑 原始数据 按行查看 历史
package main
import (
"crypto/tls"
)
// readClientCert - helper function to read client certificate
// from pem formatted certPath and keyPath files
func readClientCert(certPath, keyPath string) ([]tls.Certificate, error) {
if certPath != "" && keyPath != "" {
// load keypair
cert, err := tls.LoadX509KeyPair(certPath, keyPath)
if err != nil {
return nil, err
}
return []tls.Certificate{cert}, nil
}
return nil, nil
}
// generateTLSConfig - helper function to generate a TLS configuration based on
// config
func generateTLSConfig(c config) (*tls.Config, error) {
certs, err := readClientCert(c.certPath, c.keyPath)
if err != nil {
return nil, err
}
// Disable gas warning, because InsecureSkipVerify may be set to true
// for the purpose of testing
/* #nosec */
tlsConfig := &tls.Config{
InsecureSkipVerify: c.insecure,
Certificates: certs,
}
return tlsConfig, nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/bombardier.git
git@gitee.com:mirrors/bombardier.git
mirrors
bombardier
bombardier
v1.2.5

搜索帮助