vanng822 / go-solr

Solr client in Go, core admin, add docs, update, delete, search and more
MIT License
69 stars 42 forks source link

I want to use it in a Proxy environment #58

Open hiranoqueworks opened 2 years ago

hiranoqueworks commented 2 years ago

Request

Reason : I want to use it in a Proxy environment

Make a request connection.go Line:16 var transport = http.Transport{}

Don't initialize with empty, just use DefaultTransport or or add the following function func SetTransport(h http.Transport) { transport = h }

Example : http.DefaultTransport = &http.Transport{ Proxy: http.ProxyURL(proxyUrl) } I want to use defaultTransport and use it around like Or tr := &http.Transport{ ResponseHeaderTimeout: 30 time.Second, Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 2 time.Second, }).DialContext, MaxIdleConns: 0, IdleConnTimeout: 30 time.Second, TLSHandshakeTimeout: 2 time.Second, }), Second, MaxIdleConnsPerHost: 100, //DisableKeepAlives: false, DisableKeepAlives: true, } solr.SetTransport(tr)

Please.

vanng822 commented 2 years ago

I don't remember all those changes. However, I think it may be good to start with default var transport = http.DefaultTransport And having a set function for those that need to keep DefaultTransport as it is but want this transport different.

Do you have time help with a PR? I am lack of time and lock of development tools

hiranoqueworks commented 2 years ago

You can do it that way

var transport = http.DefaultTransport

Can I modify it and pull request?

vanng822 commented 2 years ago

Yes we can start with it