I need to create a function that returns a self signed proxy http.Client and I couldn't find any working solution.
I am attaching my current code that doesn't seem to be working.
func CreateProxyClient(server string,serverProxy string, sid string, portProxy int) (*Client, error) {
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
proxyURL, _ := url.Parse("http://" + serverProxy+":"+strconv.Itoa(portProxy) )
http.DefaultTransport = &http.Transport{
Proxy: http.ProxyURL(proxyURL),
}
var netClient = &http.Client{
Timeout: time.Second * 1,
}
resp, _ := http.Get("http://"+server+":443")
fmt.Printf("%d",resp.StatusCode)
return &Client{netClient, server, sid, "", ""}, nil
}
I