added skip vetify of server cert
This commit is contained in:
+11
-3
@@ -16,11 +16,19 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type roundTripper struct{}
|
||||
type RoundTripper struct {
|
||||
skipTLSVerify bool
|
||||
}
|
||||
|
||||
func (t *roundTripper) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||
func NewRoundTripper(skipTLSVerify bool) *RoundTripper {
|
||||
return &RoundTripper{
|
||||
skipTLSVerify: skipTLSVerify,
|
||||
}
|
||||
}
|
||||
|
||||
func (t *RoundTripper) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||
tlsConfig := &tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
InsecureSkipVerify: t.skipTLSVerify,
|
||||
}
|
||||
httpTransport := &http.Transport{
|
||||
TLSClientConfig: tlsConfig,
|
||||
|
||||
Reference in New Issue
Block a user