diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-06-21 13:10:40 -0700 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2018-06-21 16:10:40 -0400 |
commit | 8526739066ccb00ccd24b74650a7d7b284442985 (patch) | |
tree | 282512ae2ad95c98a9ca82de304a410b6b56685c /vendor/github.com/miekg/dns/client.go | |
parent | a59ccaa8b3844895dde3980e6224fef46ff4a1c8 (diff) | |
download | chat-8526739066ccb00ccd24b74650a7d7b284442985.tar.gz chat-8526739066ccb00ccd24b74650a7d7b284442985.tar.bz2 chat-8526739066ccb00ccd24b74650a7d7b284442985.zip |
MM-10934 Update server dependencies. (#8981)
* Changing throttled import path.
* Upgrading dependencies.
Diffstat (limited to 'vendor/github.com/miekg/dns/client.go')
-rw-r--r-- | vendor/github.com/miekg/dns/client.go | 28 |
1 files changed, 9 insertions, 19 deletions
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 |