Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertificateProvider ¶ added in v0.2.0
type CertificateProvider interface { GetCertificate(preferredSupplier string, subject string, altNames []string) (*tls.Certificate, error) GetExistingCertificate(preferredSupplier string, subject string, altNames []string) (*tls.Certificate, bool, error) }
CertificateProvider defines the interface for providing certificates to a Manager.
type CertificateStatus ¶ added in v0.3.0
type CertificateStatus int
CertificateStatus describes the current status of the route's certificate
const ( CertificateNotChecked CertificateStatus = iota // The route has just been initialised, so we don't yet know CertificateMissing // The certificate is required and no valid one is held CertificateExpiringSoon // We have a certificate but it needs to be renewed CertificateGood // We have a certificate and it is in good order CertificateNotRequired // We don't have a certificate and are happy about it )
type HeaderOp ¶
type HeaderOp int
HeaderOp determines how a header should be modified.
const ( HeaderOpDelete HeaderOp = iota // Deletes all instances of the header HeaderOpAdd // Adds a new header, regardless of existing ones HeaderOpReplace // Removes any existing headers of the same name, and adds a new one HeaderOpDefault // Sets the header if it doesn't already exist, otherwise leaves it alone )
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is responsible for maintaining a set of routes, mapping domains to those routes, and refreshing the certificates for those routes.
func NewManager ¶
func NewManager(provider CertificateProvider) *Manager
NewManager creates a new route provider. Routes should be set using the SetRoutes method after creation. If the provider is nil, then the manager will not obtain certificates and CertificateForClient will always return an error.
func (*Manager) CertificateForClient ¶
func (m *Manager) CertificateForClient(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
CertificateForClient returns a certificate (if one exists) for the domain specified in the provided client hello. If no certificate is available, nil is returned. The error return value is unused, but is kept to maintain compatibility with the tls.Config.GetCertificate func signature.
func (*Manager) CheckCertificates ¶
func (m *Manager) CheckCertificates()
CheckCertificates checks and updates the certificates required for registered routes. It should be called periodically to renew certificates and obtain new OCSP staples.
func (*Manager) RouteForDomain ¶
RouteForDomain returns the previously-registered route for the given domain. If no routes match the domain, nil is returned.
type Redirector ¶
type Redirector struct { }
Redirector is a http.Handler that redirects all requests to HTTPS.
func (*Redirector) ServeHTTP ¶
func (r *Redirector) ServeHTTP(writer http.ResponseWriter, request *http.Request)
type Rewriter ¶
type Rewriter struct {
// contains filtered or unexported fields
}
Rewriter facilitates rewriting HTTP requests and responses according to the routes provided by a Manager.
func NewRewriter ¶
NewRewriter creates a new Rewriter backed by the given route manager.
func (*Rewriter) RewriteRequest ¶
RewriteRequest modifies the given request according to the routes provided by the Manager. It satisfies the signature of the Director field of httputil.ReverseProxy.