certs

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2017 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package certs start a background goroutine to update a CertificatesCache of ACM and IAM certificates and an algorithm to find the best matching certificate.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMatchingCertificateFound = errors.New("no matching certificate found")

ErrNoMatchingCertificateFound is used if there is no matching ACM certificate found

Functions

This section is empty.

Types

type CertificateSummary

type CertificateSummary struct {
	// contains filtered or unexported fields
}

CertificateSummary is the business object for Certificates

func FindBestMatchingCertificate

func FindBestMatchingCertificate(certs []*CertificateSummary, hostname string) (*CertificateSummary, error)

FindBestMatchingCertificate uses a suffix search, best match operation, in order to find the best matching certificate for a given hostname.

func NewCertificate

func NewCertificate(id string, san []string, notBefore time.Time, notAfter time.Time) *CertificateSummary

NewCertificate returns a new CertificateSummary with the matching fields set from the arguments

func (*CertificateSummary) ID

func (c *CertificateSummary) ID() string

ID returns the certificate ID for the underlying provider

func (*CertificateSummary) IsValidAt

func (c *CertificateSummary) IsValidAt(when time.Time) bool

IsValidAt asserts if the the argument is contained in the certificate's date interval

func (*CertificateSummary) NotAfter

func (c *CertificateSummary) NotAfter() time.Time

NotAfter returns the field with the same name from the certificate

func (*CertificateSummary) NotBefore

func (c *CertificateSummary) NotBefore() time.Time

NotBefore returns the field with the same name from the certificate

func (*CertificateSummary) SubjectAlternativeNames

func (c *CertificateSummary) SubjectAlternativeNames() []string

SubjectAlternativeNames returns all the additional host names (sites, IP addresses, common names, etc.) protected by the certificate

type CertificatesProvider

type CertificatesProvider interface {
	GetCertificates() ([]*CertificateSummary, error)
}

CertificatesProvider interface for Certificate Provider like local, AWS IAM or AWS ACM

func NewCachingProvider

func NewCachingProvider(certUpdateInterval time.Duration, providers ...CertificatesProvider) (CertificatesProvider, error)

NewCachingProvider collects certificates from multiple providers and keeps them cached in memory. After an initial loading of certificates it will continue to refresh the cache every certUpdateInterval in the background. If the background refresh fails the last known cached values are considered current.

Jump to

Keyboard shortcuts

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