mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-09-21 15:36:04 +00:00
chore: only init cert.Leaf when not populated
since Go 1.23, cert.Leaf will be populated after loaded. see doc of tls.LoadX509KeyPair for details
This commit is contained in:
@@ -94,9 +94,12 @@ func (l *LocalCertificateLoader) makeCache() (cache *localCertificateCache, err
|
||||
return
|
||||
}
|
||||
c.certificate = &cert
|
||||
c.certificate.Leaf, err = x509.ParseCertificate(cert.Certificate[0])
|
||||
if err != nil {
|
||||
return
|
||||
if c.certificate.Leaf == nil {
|
||||
// certificate.Leaf was left nil by tls.LoadX509KeyPair before Go 1.23
|
||||
c.certificate.Leaf, err = x509.ParseCertificate(cert.Certificate[0])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
cache = c
|
||||
|
Reference in New Issue
Block a user