mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 13:04:02 +03:00
Add TrustTLS method to networkHTTPTransport
This commit is contained in:
+12
-1
@@ -1,6 +1,9 @@
|
|||||||
package network
|
package network
|
||||||
|
|
||||||
import "net/http"
|
import (
|
||||||
|
"crypto/tls"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
type networkHTTPTransport struct {
|
type networkHTTPTransport struct {
|
||||||
userAgent string
|
userAgent string
|
||||||
@@ -12,3 +15,11 @@ func (n networkHTTPTransport) RoundTrip(req *http.Request) (*http.Response, erro
|
|||||||
|
|
||||||
return n.next.RoundTrip(req) //nolint: wrapcheck
|
return n.next.RoundTrip(req) //nolint: wrapcheck
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n networkHTTPTransport) TrustTLS() {
|
||||||
|
tr := n.next.(*http.Transport)
|
||||||
|
if tr.TLSClientConfig == nil {
|
||||||
|
tr.TLSClientConfig = &tls.Config{}
|
||||||
|
}
|
||||||
|
tr.TLSClientConfig.InsecureSkipVerify = true
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user