mirror of
https://git.sr.ht/~adnano/go-gemini
synced 2024-09-20 03:11:34 +02:00
25 lines
521 B
Go
25 lines
521 B
Go
package gemini
|
|
|
|
import (
|
|
"crypto/x509"
|
|
)
|
|
|
|
// CertificateStore maps hostnames to certificates.
|
|
type CertificateStore struct {
|
|
store map[string]*x509.Certificate // map of hostnames to certificates
|
|
}
|
|
|
|
func NewCertificateStore() *CertificateStore {
|
|
return &CertificateStore{
|
|
store: map[string]*x509.Certificate{},
|
|
}
|
|
}
|
|
|
|
func (c *CertificateStore) Put(hostname string, cert *x509.Certificate) {
|
|
c.store[hostname] = cert
|
|
}
|
|
|
|
func (c *CertificateStore) Get(hostname string) *x509.Certificate {
|
|
return c.store[hostname]
|
|
}
|