mirror of
https://github.com/miekg/dns.git
synced 2025-10-09 08:51:00 +02:00
Use tls.Dialer in Client.DialContext (#1430)
This has been a long standing TODO we can cross off as tls.Dialer is well supported now.
This commit is contained in:
parent
b69c3a2007
commit
fc45796497
@ -106,7 +106,6 @@ func (c *Client) Dial(address string) (conn *Conn, err error) {
|
||||
}
|
||||
|
||||
// DialContext connects to the address on the named network, with a context.Context.
|
||||
// For TLS over TCP (DoT) the context isn't used yet. This will be enabled when Go 1.18 is released.
|
||||
func (c *Client) DialContext(ctx context.Context, address string) (conn *Conn, err error) {
|
||||
// create a new dialer with the appropriate timeout
|
||||
var d net.Dialer
|
||||
@ -127,15 +126,11 @@ func (c *Client) DialContext(ctx context.Context, address string) (conn *Conn, e
|
||||
if useTLS {
|
||||
network = strings.TrimSuffix(network, "-tls")
|
||||
|
||||
// TODO(miekg): Enable after Go 1.18 is released, to be able to support two prev. releases.
|
||||
/*
|
||||
tlsDialer := tls.Dialer{
|
||||
NetDialer: &d,
|
||||
Config: c.TLSConfig,
|
||||
}
|
||||
conn.Conn, err = tlsDialer.DialContext(ctx, network, address)
|
||||
*/
|
||||
conn.Conn, err = tls.DialWithDialer(&d, network, address, c.TLSConfig)
|
||||
} else {
|
||||
conn.Conn, err = d.DialContext(ctx, network, address)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user