Skip to content

Instantly share code, notes, and snippets.

@AKosterin
Created July 16, 2018 12:54
Show Gist options
  • Save AKosterin/7af2037b18d252e31662d9cf5e0119de to your computer and use it in GitHub Desktop.
Save AKosterin/7af2037b18d252e31662d9cf5e0119de to your computer and use it in GitHub Desktop.
func initProxyHttpClient(proxyUrl string, insecure bool) *http.Client {
pu, _ := url.Parse(proxyUrl)
return &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyURL(pu),
TLSNextProto: make(map[string]func(authority string, c *tls.Conn) http.RoundTripper),
TLSClientConfig: &tls.Config{
InsecureSkipVerify: insecure,
},
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment