From e9c891d5b5cfdff1a42ccfef1735c4d28d84ff2c Mon Sep 17 00:00:00 2001 From: Darhwa <65339668+darhwa@users.noreply.github.com> Date: Fri, 31 Jul 2020 13:11:42 +0800 Subject: [PATCH] Enable ForceAttemptHTTP2 on DoH client --- app/dns/dohdns.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/dns/dohdns.go b/app/dns/dohdns.go index 02b0906c..3f4f7dcd 100644 --- a/app/dns/dohdns.go +++ b/app/dns/dohdns.go @@ -58,6 +58,7 @@ func NewDoHNameServer(url *url.URL, dispatcher routing.Dispatcher, clientIP net. MaxIdleConns: 30, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 30 * time.Second, + ForceAttemptHTTP2: true, DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { dest, err := net.ParseDestination(network + ":" + addr) if err != nil { @@ -89,7 +90,8 @@ func NewDoHLocalNameServer(url *url.URL, clientIP net.IP) *DoHNameServer { url.Scheme = "https" s := baseDOHNameServer(url, "DOHL", clientIP) tr := &http.Transport{ - IdleConnTimeout: 90 * time.Second, + IdleConnTimeout: 90 * time.Second, + ForceAttemptHTTP2: true, DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { dest, err := net.ParseDestination(network + ":" + addr) if err != nil {