From 4ba72389bf6c485be77c83a9bdf78f3544e01e56 Mon Sep 17 00:00:00 2001 From: Ansar Smagulov Date: Sat, 16 Dec 2023 01:45:52 +0600 Subject: [PATCH] refactor: expiresAt -> notAfter --- certmanager/get.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/certmanager/get.go b/certmanager/get.go index b2d40ebe..e7fb051d 100644 --- a/certmanager/get.go +++ b/certmanager/get.go @@ -33,7 +33,7 @@ func (cm *CertManager) GetCertificate(host string) (*tls.Certificate, error) { return nil, fmt.Errorf("generate serial number: %v", err) } - expiresAt := time.Now().Add(certTTL) + notAfter := time.Now().Add(certTTL) template := x509.Certificate{ SerialNumber: serialNumber, Subject: pkix.Name{ @@ -41,7 +41,7 @@ func (cm *CertManager) GetCertificate(host string) (*tls.Certificate, error) { }, DNSNames: []string{host}, NotBefore: time.Now(), - NotAfter: expiresAt, + NotAfter: notAfter, KeyUsage: x509.KeyUsageDigitalSignature, ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}, @@ -71,7 +71,7 @@ func (cm *CertManager) GetCertificate(host string) (*tls.Certificate, error) { return nil, fmt.Errorf("load key pair: %v", err) } - cm.certCache.Put(host, expiresAt.Add(-5*time.Minute), &cert) // 5 minute buffer in case a TLS handshake takes a while, the system clock is off, etc. + cm.certCache.Put(host, notAfter.Add(-5*time.Minute), &cert) // 5 minute buffer in case a TLS handshake takes a while, the system clock is off, etc. return &cert, nil }