mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 22:34:02 +03:00
FILE / ScuroNeko/mtg
network/v2/http.go
Исходный файл и его история в репозитории.
26 lines
517 B
Go
26 lines
517 B
Go
package network
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"net/http"
|
|
)
|
|
|
|
type networkHTTPTransport struct {
|
|
userAgent string
|
|
next http.RoundTripper
|
|
}
|
|
|
|
func (n networkHTTPTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
req.Header.Set("User-Agent", n.userAgent)
|
|
|
|
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
|
|
}
|