From 8526739066ccb00ccd24b74650a7d7b284442985 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Thu, 21 Jun 2018 13:10:40 -0700 Subject: MM-10934 Update server dependencies. (#8981) * Changing throttled import path. * Upgrading dependencies. --- vendor/github.com/miekg/dns/client.go | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'vendor/github.com/miekg/dns/client.go') diff --git a/vendor/github.com/miekg/dns/client.go b/vendor/github.com/miekg/dns/client.go index 6aa4235d1..dd6b512af 100644 --- a/vendor/github.com/miekg/dns/client.go +++ b/vendor/github.com/miekg/dns/client.go @@ -12,15 +12,16 @@ import ( "io/ioutil" "net" "net/http" - "net/url" "strings" "time" ) -const dnsTimeout time.Duration = 2 * time.Second -const tcpIdleTimeout time.Duration = 8 * time.Second +const ( + dnsTimeout time.Duration = 2 * time.Second + tcpIdleTimeout time.Duration = 8 * time.Second -const dohMimeType = "application/dns-udpwireformat" + dohMimeType = "application/dns-message" +) // A Conn represents a connection to a DNS server. type Conn struct { @@ -88,11 +89,10 @@ func (c *Client) Dial(address string) (conn *Conn, err error) { // create a new dialer with the appropriate timeout var d net.Dialer if c.Dialer == nil { - d = net.Dialer{} + d = net.Dialer{Timeout:c.getTimeoutForRequest(c.dialTimeout())} } else { d = net.Dialer(*c.Dialer) } - d.Timeout = c.getTimeoutForRequest(c.writeTimeout()) network := "udp" useTLS := false @@ -214,17 +214,7 @@ func (c *Client) exchangeDOH(ctx context.Context, m *Msg, a string) (r *Msg, rtt return nil, 0, err } - // TODO(tmthrgd): Allow the path to be customised? - u := &url.URL{ - Scheme: "https", - Host: a, - Path: "/.well-known/dns-query", - } - if u.Port() == "443" { - u.Host = u.Hostname() - } - - req, err := http.NewRequest(http.MethodPost, u.String(), bytes.NewReader(p)) + req, err := http.NewRequest(http.MethodPost, a, bytes.NewReader(p)) if err != nil { return nil, 0, err } @@ -232,8 +222,6 @@ func (c *Client) exchangeDOH(ctx context.Context, m *Msg, a string) (r *Msg, rtt req.Header.Set("Content-Type", dohMimeType) req.Header.Set("Accept", dohMimeType) - t := time.Now() - hc := http.DefaultClient if c.HTTPClient != nil { hc = c.HTTPClient @@ -243,6 +231,8 @@ func (c *Client) exchangeDOH(ctx context.Context, m *Msg, a string) (r *Msg, rtt req = req.WithContext(ctx) } + t := time.Now() + resp, err := hc.Do(req) if err != nil { return nil, 0, err -- cgit v1.2.3-1-g7c22