diff options
| author | adnano <[email protected]> | 2020-09-28 00:29:11 -0400 |
|---|---|---|
| committer | adnano <[email protected]> | 2020-09-28 00:29:11 -0400 |
| commit | 622ea8e0f1e5f985e2e4f22b83bac8ed363897cb (patch) | |
| tree | 50772f5a5050c8c15b80076a727656def4978a5b /examples | |
| parent | Remove log.Print call (diff) | |
| download | go-gemini-622ea8e0f1e5f985e2e4f22b83bac8ed363897cb.tar.xz go-gemini-622ea8e0f1e5f985e2e4f22b83bac8ed363897cb.zip | |
Update documentation
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/client/client.go | 4 |
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 } |