certificate

package
v0.0.0-...-296934d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LetsEncryptStagingURL uri for the LE staging environment with higher rate limits
	LetsEncryptStagingURL = "https://acme-staging.api.letsencrypt.org/directory"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	CertCache   *PersistentCertCache
	AcmeManager *autocert.Manager
}

Manager wraps around autocert and injects a cache

func NewManager

func NewManager(d *db.DynamoDB, staging bool) *Manager

NewManager creates a new instance

func (*Manager) AllowHostPolicy

func (m *Manager) AllowHostPolicy(_ context.Context, host string) error

AllowHostPolicy decides which host shall pass

func (*Manager) GetCertificate

func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)

GetCertificate wrapper for the cert getter

func (*Manager) GetDomain

func (m *Manager) GetDomain(host string) (*db.Domain, error)

GetDomain by name

func (*Manager) Serve

func (m *Manager) Serve(fallback http.Handler, w http.ResponseWriter, r *http.Request)

Serve http.Handler bridge

type PersistentCertCache

type PersistentCertCache struct {
	autocert.Cache
	DB         *db.DynamoDB
	PollTicker *time.Ticker
	MapMutex   *sync.Mutex
	DomainsMap map[string]db.Domain
}

PersistentCertCache certificate cache

func NewPersistentCertCache

func NewPersistentCertCache(d *db.DynamoDB) *PersistentCertCache

NewPersistentCertCache creates a new persistent cache based on dynamo db

func (*PersistentCertCache) Delete

func (c *PersistentCertCache) Delete(ctx context.Context, key string) error

Delete a domain from

func (*PersistentCertCache) Get

func (c *PersistentCertCache) Get(ctx context.Context, key string) ([]byte, error)

Get cert by domain name

func (*PersistentCertCache) IsDomainAcceptable

func (c *PersistentCertCache) IsDomainAcceptable(domain string) (*db.Domain, bool)

IsDomainAcceptable test for domains in cache

func (*PersistentCertCache) Observe

func (c *PersistentCertCache) Observe() error

Observe the domain backend. Ya through polling. Pub/Sub would be much better. Go implement it

func (*PersistentCertCache) Put

func (c *PersistentCertCache) Put(ctx context.Context, key string, data []byte) error

Put a cert to the cache

func (*PersistentCertCache) UpdateDomainCache

func (c *PersistentCertCache) UpdateDomainCache()

UpdateDomainCache updates the domain cache

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL