aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2021-01-14 20:42:12 -0500
committerAdnan Maolood <[email protected]>2021-01-14 20:42:12 -0500
commit14d89f304ad022bb61158d498869d63bc5109e7a (patch)
tree3af9d2f1c08a4053da94e23181a2d792e04af0f0 /server.go
parenttofu: Fix example (diff)
downloadgo-gemini-14d89f304ad022bb61158d498869d63bc5109e7a.tar.xz
go-gemini-14d89f304ad022bb61158d498869d63bc5109e7a.zip
Move cert.go to a subpackage
Diffstat (limited to 'server.go')
-rw-r--r--server.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/server.go b/server.go
index 8223cbf..97f6ed3 100644
--- a/server.go
+++ b/server.go
@@ -7,6 +7,8 @@ import (
"net"
"strings"
"time"
+
+ "git.sr.ht/~adnano/go-gemini/certificate"
)
// Server is a Gemini server.
@@ -23,7 +25,7 @@ type Server struct {
WriteTimeout time.Duration
// Certificates contains the certificates used by the server.
- Certificates CertificateDir
+ Certificates certificate.Dir
// CreateCertificate, if not nil, will be called to create a new certificate
// if the current one is expired or missing.
@@ -157,8 +159,7 @@ func (s *Server) getCertificateFor(hostname string) (*tls.Certificate, error) {
if s.CreateCertificate != nil {
cert, err := s.CreateCertificate(hostname)
if err == nil {
- s.Certificates.Add(hostname, cert)
- if err := s.Certificates.Write(hostname, cert); err != nil {
+ if err := s.Certificates.Add(hostname, cert); err != nil {
s.logf("gemini: Failed to write new certificate for %s: %s", hostname, err)
}
}