From b202c341f72bcc1caf9d5cef31d86b8ce3956455 Mon Sep 17 00:00:00 2001 From: fangdingjun Date: Thu, 5 Oct 2017 17:22:04 +0800 Subject: [PATCH] adjust timeout --- google_httpdns.go | 4 ++-- handler.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google_httpdns.go b/google_httpdns.go index 520d0da..aa20da9 100644 --- a/google_httpdns.go +++ b/google_httpdns.go @@ -132,10 +132,10 @@ type RR struct { } var httpclient = &http.Client{ - Timeout: 5 * time.Second, + Timeout: 8 * time.Second, Transport: &http.Transport{ TLSClientConfig: &tls.Config{ServerName: "dns.google.com"}, - TLSHandshakeTimeout: 3 * time.Second, + TLSHandshakeTimeout: 5 * time.Second, }, } diff --git a/handler.go b/handler.go index 5cb26ee..24dcb71 100644 --- a/handler.go +++ b/handler.go @@ -22,8 +22,8 @@ type dnsHandler struct { func newDNSHandler(cfg *conf) *dnsHandler { return &dnsHandler{ cfg: cfg, - tcpclient: &dns.Client{Net: "tcp", Timeout: 2 * time.Second, UDPSize: 4096}, - udpclient: &dns.Client{Net: "udp", Timeout: 2 * time.Second, UDPSize: 4096}, + tcpclient: &dns.Client{Net: "tcp", Timeout: 8 * time.Second, UDPSize: 4096}, + udpclient: &dns.Client{Net: "udp", Timeout: 5 * time.Second, UDPSize: 4096}, httpsclient: &GoogleHTTPDns{}, }