aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/client/client.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/client/client.go b/examples/client/client.go
index e8a16be..3e88c73 100644
--- a/examples/client/client.go
+++ b/examples/client/client.go
@@ -49,15 +49,17 @@ func init() {
client.CertificateStore = gmi.NewCertificateStore()
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 {
return cert
}
- // Generate a certificate
+ // Otherwise, generate a certificate
duration := time.Hour
cert, err := gmi.NewCertificate(hostname, duration)
if err != nil {
return nil
}
+ // Store and return the certificate
store[hostname] = &cert
return &cert
}