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
 | 
			
		||||
// 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 {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										5
									
								
								cert.go
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								cert.go
									
									
									
									
									
								
							@ -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)
 | 
			
		||||
 | 
			
		||||
@ -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 {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user