status-go/vendor/github.com/anacrolix/missinggo/httptoo/client.go

20 lines
422 B
Go
Raw Normal View History

2022-03-10 09:44:48 +00:00
package httptoo
import (
"crypto/tls"
"net/http"
)
// Returns the http.Client's TLS Config, traversing and generating any
// defaults along the way to get it.
func ClientTLSConfig(cl *http.Client) *tls.Config {
if cl.Transport == nil {
cl.Transport = http.DefaultTransport
}
tr := cl.Transport.(*http.Transport)
if tr.TLSClientConfig == nil {
tr.TLSClientConfig = &tls.Config{}
}
return tr.TLSClientConfig
}