perf(tls): enable session resumption on the stdlib transports

This commit is contained in:
zarzet
2026-07-14 09:09:24 +07:00
parent 86d5ae3a2b
commit 122b16133a
+7
View File
@@ -74,9 +74,16 @@ func supplementalRootCAs() *x509.CertPool {
return supplementalRootCAsPool
}
// stdTLSSessionCache is shared by every stdlib transport so TLS session
// tickets enable resumption (fewer handshake round-trips) after idle-pool
// evictions and network switches. Package-level so toggling compatibility
// options does not drop accumulated sessions.
var stdTLSSessionCache = tls.NewLRUClientSessionCache(64)
func newTLSCompatibilityConfig(insecureTLS bool) *tls.Config {
return &tls.Config{
RootCAs: supplementalRootCAs(),
InsecureSkipVerify: insecureTLS,
ClientSessionCache: stdTLSSessionCache,
}
}