Skip to content

Commit

Permalink
copy more tls config to utls (fix #387)
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Sep 21, 2024
1 parent db181cc commit 8d3a134
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1198,11 +1198,21 @@ func (c *Client) SetTLSFingerprint(clientHelloID utls.ClientHelloID) *Client {
colonPos = len(addr)
}
hostname := addr[:colonPos]
tlsConfig := c.GetTLSClientConfig()
utlsConfig := &utls.Config{
ServerName: hostname,
RootCAs: c.GetTLSClientConfig().RootCAs,
NextProtos: c.GetTLSClientConfig().NextProtos,
InsecureSkipVerify: c.GetTLSClientConfig().InsecureSkipVerify,
ServerName: hostname,
Rand: tlsConfig.Rand,
Time: tlsConfig.Time,
RootCAs: tlsConfig.RootCAs,
NextProtos: tlsConfig.NextProtos,
ClientCAs: tlsConfig.ClientCAs,
InsecureSkipVerify: tlsConfig.InsecureSkipVerify,
CipherSuites: tlsConfig.CipherSuites,
SessionTicketsDisabled: tlsConfig.SessionTicketsDisabled,
MinVersion: tlsConfig.MinVersion,
MaxVersion: tlsConfig.MaxVersion,
DynamicRecordSizingDisabled: tlsConfig.DynamicRecordSizingDisabled,
KeyLogWriter: tlsConfig.KeyLogWriter,
}
uconn := &uTLSConn{utls.UClient(plainConn, utlsConfig, clientHelloID)}
err = uconn.HandshakeContext(ctx)
Expand Down

0 comments on commit 8d3a134

Please sign in to comment.