fix: tls config unused with dialer

This ensures the configured tls.Config is used with the tls.Dialer.
This commit is contained in:
James Elliott 2022-12-26 22:07:47 +11:00
parent 6a7d49f1b6
commit b8646489ae
No known key found for this signature in database
GPG key ID: 0F1C4A096E857E49

View file

@ -431,9 +431,11 @@ func (c *Client) DialWithContext(pc context.Context) error {
defer cfn() defer cfn()
nd := net.Dialer{} nd := net.Dialer{}
td := tls.Dialer{}
var err error var err error
if c.ssl { if c.ssl {
td := tls.Dialer{NetDialer: &nd, Config: c.tlsconfig}
c.enc = true c.enc = true
c.co, err = td.DialContext(ctx, "tcp", c.ServerAddr()) c.co, err = td.DialContext(ctx, "tcp", c.ServerAddr())
} }