Open JonathanSlowwe opened 3 years ago
Couldn't you use the Custom HTTP client functionality like so?
type myHTTPClient struct {
client http.Client
}
func (c *myHTTPClient) Do(request *http.Request) (*http.Response, error) {
return c.client.Do(request)
}
proxy := "http://" + selectProxy
proxyURL, _ := url.Parse(proxy)
transport := &http.Transport{Proxy: http.ProxyURL(proxyURL)}
httpclient.NewClient(httpclient.WithHTTPClient(&myHTTPClient{client: &http.Client{Transport: transport, Timeout: 5 * time.Second}}))
This is my hystrix client:
I cant seem a way to parse in proxies so it sends requests from different IP addresses. This is how I would do it in net/http:
proxy := "http://" + selectProxy proxyURL, _ := url.Parse(proxy) transport := &http.Transport{Proxy: http.ProxyURL(proxyURL)}
client := &http.Client{Transport: transport, Timeout: 5 * time.Second}
Any help or tips to parse in the http transport/ dial or proxies with the hystrix client would be appreciated.