Add idle conn timeout for HTTP transport

Allowing the connection to be re-new once it becomes un-usable.
This commit is contained in:
Cuong Manh Le
2023-02-28 09:29:57 +07:00
committed by Cuong Manh Le
parent 2e1b3f9d07
commit 8852f60ccb

View File

@@ -157,6 +157,7 @@ func (uc *UpstreamConfig) SetupTransport() {
func (uc *UpstreamConfig) setupDOHTransport() {
uc.transport = http.DefaultTransport.(*http.Transport).Clone()
uc.transport.IdleConnTimeout = 5 * time.Second
uc.transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
dialer := &net.Dialer{
Timeout: 10 * time.Second,