Consider that I have an http.Client
where multiple goroutines are making GET
request using the same http client, my problem is I want to guarantee that each get request is done through a different Proxy.
I couldn't find a way to achieve that in the net/http/Transport
docs, is my best bet using a pool of http clients, or modify the go/src/net/http/transport.go
to receive a function that will return a proxy to be used per request?
thanks to JimB turns out its as simple as something like
client := &http.Client{Transport: &http.Transport{Proxy: func(r *http.Request) (*url.URL, error) {
proxyUrl, err := url.Parse(GetProxyUrl())
return proxyUrl, err
}}}