diff options
| author | Adnan Maolood <[email protected]> | 2020-10-28 13:40:25 -0400 |
|---|---|---|
| committer | Adnan Maolood <[email protected]> | 2020-10-28 13:41:24 -0400 |
| commit | fbd97a62dec02ad22b7cf520cfc6ab519ea0e990 (patch) | |
| tree | 8a19117713cddce2d3ed2d31c24bec59fe616a48 /gemini.go | |
| parent | Add ErrInputRequired and ErrCertificateRequired (diff) | |
| download | go-gemini-fbd97a62dec02ad22b7cf520cfc6ab519ea0e990.tar.xz go-gemini-fbd97a62dec02ad22b7cf520cfc6ab519ea0e990.zip | |
Refactor client certificates
Diffstat (limited to 'gemini.go')
| -rw-r--r-- | gemini.go | 15 |
1 files changed, 4 insertions, 11 deletions
@@ -51,16 +51,9 @@ func init() { defaultClientOnce.Do(func() { knownHosts.LoadDefault() }) return knownHosts.Lookup(hostname, cert) } - DefaultClient.GetCertificate = func(req *Request, store *ClientCertificateStore) *tls.Certificate { - if cert, err := store.Lookup(req.URL.Hostname(), req.URL.Path); err == nil { - return cert - } - duration := time.Hour - cert, err := NewCertificate("", duration) - if err != nil { - return nil - } - store.Add(req.URL.Hostname()+req.URL.Path, cert) - return &cert + DefaultClient.CreateCertificate = func(hostname, path string) (tls.Certificate, error) { + return CreateCertificate(CertificateOptions{ + Duration: time.Hour, + }) } } |