Remove NewCertificateStore function

This commit is contained in:
adnano 2020-09-28 00:41:00 -04:00
parent cad2d25185
commit 956a2bad52
4 changed files with 3 additions and 8 deletions

View File

@ -89,7 +89,7 @@ The default client handles this for you. Other clients must specify the fields
```go
// Initialize the certificate store.
client.CertificateStore = gmi.NewCertificateStore()
client.CertificateStore = gmi.CertificateStore{}
// GetCertificate is called when a server requests a certificate.
// The returned certificate, if not nil, will be used when resending the request.
client.GetCertificate = func(hostname string, store gmi.CertificateStore) *tls.Certificate {

View File

@ -17,11 +17,6 @@ import (
// CertificateStore maps hostnames to certificates.
type CertificateStore map[string]*tls.Certificate
// NewCertificateStore creates and returns a new certificate store.
func NewCertificateStore() CertificateStore {
return map[string]*tls.Certificate{}
}
// NewCertificate creates and returns a new parsed certificate.
func NewCertificate(host string, duration time.Duration) (tls.Certificate, error) {
crt, key, err := NewRawCertificate(host, duration)

View File

@ -47,7 +47,7 @@ func init() {
return err
}
client.CertificateStore = gmi.NewCertificateStore()
client.CertificateStore = gmi.CertificateStore{}
client.GetCertificate = func(hostname string, store gmi.CertificateStore) *tls.Certificate {
// If the certificate is in the store, return it
if cert, ok := store[hostname]; ok {

View File

@ -76,7 +76,7 @@ func init() {
var setupDefaultClientOnce sync.Once
func setupDefaultClient() {
DefaultClient.CertificateStore = NewCertificateStore()
DefaultClient.CertificateStore = CertificateStore{}
DefaultClient.KnownHosts.Load()
}