From 622ea8e0f1e5f985e2e4f22b83bac8ed363897cb Mon Sep 17 00:00:00 2001 From: adnano Date: Mon, 28 Sep 2020 00:29:11 -0400 Subject: Update documentation --- examples/client/client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples') 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 } -- cgit v1.2.3