Remove NewCertificateStore function
This commit is contained in:
parent
cad2d25185
commit
956a2bad52
@ -89,7 +89,7 @@ The default client handles this for you. Other clients must specify the fields
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
// Initialize the certificate store.
|
// Initialize the certificate store.
|
||||||
client.CertificateStore = gmi.NewCertificateStore()
|
client.CertificateStore = gmi.CertificateStore{}
|
||||||
// GetCertificate is called when a server requests a certificate.
|
// GetCertificate is called when a server requests a certificate.
|
||||||
// The returned certificate, if not nil, will be used when resending the request.
|
// The returned certificate, if not nil, will be used when resending the request.
|
||||||
client.GetCertificate = func(hostname string, store gmi.CertificateStore) *tls.Certificate {
|
client.GetCertificate = func(hostname string, store gmi.CertificateStore) *tls.Certificate {
|
||||||
|
5
cert.go
5
cert.go
@ -17,11 +17,6 @@ import (
|
|||||||
// CertificateStore maps hostnames to certificates.
|
// CertificateStore maps hostnames to certificates.
|
||||||
type CertificateStore map[string]*tls.Certificate
|
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.
|
// NewCertificate creates and returns a new parsed certificate.
|
||||||
func NewCertificate(host string, duration time.Duration) (tls.Certificate, error) {
|
func NewCertificate(host string, duration time.Duration) (tls.Certificate, error) {
|
||||||
crt, key, err := NewRawCertificate(host, duration)
|
crt, key, err := NewRawCertificate(host, duration)
|
||||||
|
@ -47,7 +47,7 @@ func init() {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client.CertificateStore = gmi.NewCertificateStore()
|
client.CertificateStore = gmi.CertificateStore{}
|
||||||
client.GetCertificate = func(hostname string, store gmi.CertificateStore) *tls.Certificate {
|
client.GetCertificate = func(hostname string, store gmi.CertificateStore) *tls.Certificate {
|
||||||
// If the certificate is in the store, return it
|
// If the certificate is in the store, return it
|
||||||
if cert, ok := store[hostname]; ok {
|
if cert, ok := store[hostname]; ok {
|
||||||
|
@ -76,7 +76,7 @@ func init() {
|
|||||||
var setupDefaultClientOnce sync.Once
|
var setupDefaultClientOnce sync.Once
|
||||||
|
|
||||||
func setupDefaultClient() {
|
func setupDefaultClient() {
|
||||||
DefaultClient.CertificateStore = NewCertificateStore()
|
DefaultClient.CertificateStore = CertificateStore{}
|
||||||
DefaultClient.KnownHosts.Load()
|
DefaultClient.KnownHosts.Load()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user