forked from quic-go/quic-go
don't modify the tls.Config when generating the qtls.Config
This fixes a race conditions when dialing or accepting multiple connections using the same tls.Config.
This commit is contained in:
@@ -11,11 +11,13 @@ func tlsConfigToQtlsConfig(c *tls.Config) *qtls.Config {
|
|||||||
c = &tls.Config{}
|
c = &tls.Config{}
|
||||||
}
|
}
|
||||||
// QUIC requires TLS 1.3 or newer
|
// QUIC requires TLS 1.3 or newer
|
||||||
if c.MinVersion < qtls.VersionTLS13 {
|
minVersion := c.MinVersion
|
||||||
c.MinVersion = qtls.VersionTLS13
|
if minVersion < qtls.VersionTLS13 {
|
||||||
|
minVersion = qtls.VersionTLS13
|
||||||
}
|
}
|
||||||
if c.MaxVersion < qtls.VersionTLS13 {
|
maxVersion := c.MaxVersion
|
||||||
c.MaxVersion = qtls.VersionTLS13
|
if maxVersion < qtls.VersionTLS13 {
|
||||||
|
maxVersion = qtls.VersionTLS13
|
||||||
}
|
}
|
||||||
return &qtls.Config{
|
return &qtls.Config{
|
||||||
Rand: c.Rand,
|
Rand: c.Rand,
|
||||||
@@ -38,8 +40,8 @@ func tlsConfigToQtlsConfig(c *tls.Config) *qtls.Config {
|
|||||||
PreferServerCipherSuites: c.PreferServerCipherSuites,
|
PreferServerCipherSuites: c.PreferServerCipherSuites,
|
||||||
SessionTicketsDisabled: c.SessionTicketsDisabled,
|
SessionTicketsDisabled: c.SessionTicketsDisabled,
|
||||||
SessionTicketKey: c.SessionTicketKey,
|
SessionTicketKey: c.SessionTicketKey,
|
||||||
MinVersion: c.MinVersion,
|
MinVersion: minVersion,
|
||||||
MaxVersion: c.MaxVersion,
|
MaxVersion: maxVersion,
|
||||||
CurvePreferences: c.CurvePreferences,
|
CurvePreferences: c.CurvePreferences,
|
||||||
DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled,
|
DynamicRecordSizingDisabled: c.DynamicRecordSizingDisabled,
|
||||||
Renegotiation: c.Renegotiation,
|
Renegotiation: c.Renegotiation,
|
||||||
|
|||||||
Reference in New Issue
Block a user