From 8852f60ccba0ba8fea910c3d46a9a6d48cea08c1 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Tue, 28 Feb 2023 09:29:57 +0700 Subject: [PATCH] Add idle conn timeout for HTTP transport Allowing the connection to be re-new once it becomes un-usable. --- config.go | 1 + 1 file changed, 1 insertion(+) diff --git a/config.go b/config.go index f8d7736..f6a132c 100644 --- a/config.go +++ b/config.go @@ -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,