diff options
| author | Adnan Maolood <[email protected]> | 2020-10-28 16:02:04 -0400 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2020-10-28 16:02:04 -0400 |
| commit | b5fbd197a15e6991552c48f401206ead0501b52d (patch) | |
| tree | 5f69fc679f8eee9a92dcd6ca11b2651024609a9f /doc.go | |
| parent | Use strings.Builder in Fingerprint (diff) | |
| download | go-gemini-b5fbd197a15e6991552c48f401206ead0501b52d.tar.xz go-gemini-b5fbd197a15e6991552c48f401206ead0501b52d.zip | |
Update documentation
Diffstat (limited to 'doc.go')
| -rw-r--r-- | doc.go | 24 |
1 files changed, 7 insertions, 17 deletions
@@ -41,22 +41,12 @@ Clients can control when to trust certificates with TrustCertificate: return knownHosts.Lookup(hostname, cert) } -Clients can control what to do when a server requests a certificate: - - client.GetCertificate = func(hostname string, store *gemini.CertificateStore) *tls.Certificate { - // If the certificate is in the store, return it - if cert, err := store.Lookup(hostname); err == nil { - return &cert - } - // Otherwise, generate a certificate - duration := time.Hour - cert, err := gemini.NewCertificate(hostname, duration) - if err != nil { - return nil - } - // Store and return the certificate - store.Add(hostname, cert) - return &cert +Clients can create client certificates upon the request of a server: + + client.CreateCertificate = func(hostname, path string) *tls.Certificate { + return gemini.CreateCertificate(gemini.CertificateOptions{ + Duration: time.Hour, + }) } Server is a Gemini server. @@ -65,7 +55,7 @@ Server is a Gemini server. Servers must be configured with certificates: - err := server.CertificateStore.Load("/var/lib/gemini/certs") + err := server.Certificates.Load("/var/lib/gemini/certs") if err != nil { // handle error } |