mirror of
https://github.com/fumiama/terasu-cloudflared.git
synced 2026-06-22 20:20:59 +08:00
TUN-6780: Add support for certReload to also include support for client certificates
This commit is contained in:
@@ -40,12 +40,21 @@ func NewCertReloader(certPath, keyPath string) (*CertReloader, error) {
|
||||
}
|
||||
|
||||
// Cert returns the TLS certificate most recently read by the CertReloader.
|
||||
// This method works as a direct utility method for tls.Config#Cert.
|
||||
func (cr *CertReloader) Cert(clientHello *tls.ClientHelloInfo) (*tls.Certificate, error) {
|
||||
cr.Lock()
|
||||
defer cr.Unlock()
|
||||
return cr.certificate, nil
|
||||
}
|
||||
|
||||
// ClientCert returns the TLS certificate most recently read by the CertReloader.
|
||||
// This method works as a direct utility method for tls.Config#ClientCert.
|
||||
func (cr *CertReloader) ClientCert(certRequestInfo *tls.CertificateRequestInfo) (*tls.Certificate, error) {
|
||||
cr.Lock()
|
||||
defer cr.Unlock()
|
||||
return cr.certificate, nil
|
||||
}
|
||||
|
||||
// LoadCert loads a TLS certificate from the CertReloader's specified filepath.
|
||||
// Call this after writing a new certificate to the disk (e.g. after renewing a certificate)
|
||||
func (cr *CertReloader) LoadCert() error {
|
||||
|
||||
Reference in New Issue
Block a user