Skip to content

Commit

Permalink
chore(pkg/dot): use tls.Dialer instead of tls.Client
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Nov 3, 2024
1 parent fdd4373 commit 87b1fef
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pkg/dot/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ func (d *Dialer) Dial(ctx context.Context, _, _ string) (
serverName, serverAddress := pickNameAddress(d.picker,
d.servers, d.ipv6)

conn, err = d.netDialer.DialContext(ctx, "tcp", serverAddress)
tlsDialer := tls.Dialer{
NetDialer: d.netDialer,
Config: &tls.Config{
MinVersion: tls.VersionTLS12,
ServerName: serverName,
},
}
conn, err = tlsDialer.DialContext(ctx, "tcp", serverAddress)
if err != nil {
d.metrics.DoTDialInc(serverName, serverAddress, "error")
return nil, err
}

d.metrics.DoTDialInc(serverName, serverAddress, "success")

tlsConf := &tls.Config{
MinVersion: tls.VersionTLS12,
ServerName: serverName,
}
// TODO handshake? See tls.DialWithDialer
return tls.Client(conn, tlsConf), nil
return conn, nil
}

func pickNameAddress(picker *picker.Picker, servers []provider.DoTServer,
Expand Down

0 comments on commit 87b1fef

Please sign in to comment.