Skip to content

Commit f29e26a

Browse files
Merge pull request #80 from zmap/sync-upstream-20260120
Sync miekg/dns upstream changes
2 parents 55efb65 + ddad7ec commit f29e26a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

client.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ type Client struct {
6161
// Client.Dialer) or context.Context.Deadline (see ExchangeContext)
6262
Timeout time.Duration
6363
DialTimeout time.Duration // net.DialTimeout, defaults to 2 seconds, or net.Dialer.Timeout if expiring earlier - overridden by Timeout when that value is non-zero
64-
ReadTimeout time.Duration // net.Conn.SetReadTimeout value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero
65-
WriteTimeout time.Duration // net.Conn.SetWriteTimeout value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero
64+
ReadTimeout time.Duration // net.Conn.SetReadDeadline value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero
65+
WriteTimeout time.Duration // net.Conn.SetWriteDeadline value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero
6666
TsigSecret map[string]string // secret(s) for Tsig map[<zonename>]<base64 secret>, zonename must be in canonical form (lowercase, fqdn, see RFC 4034 Section 6.2)
6767
TsigProvider TsigProvider // An implementation of the TsigProvider interface. If defined it replaces TsigSecret and is used for all TSIG operations.
6868

@@ -96,13 +96,19 @@ func (c *Client) dialTimeout() time.Duration {
9696
}
9797

9898
func (c *Client) readTimeout() time.Duration {
99+
if c.Timeout != 0 {
100+
return c.Timeout
101+
}
99102
if c.ReadTimeout != 0 {
100103
return c.ReadTimeout
101104
}
102105
return dnsTimeout
103106
}
104107

105108
func (c *Client) writeTimeout() time.Duration {
109+
if c.Timeout != 0 {
110+
return c.Timeout
111+
}
106112
if c.WriteTimeout != 0 {
107113
return c.WriteTimeout
108114
}

0 commit comments

Comments
 (0)