Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertificateManager ¶
type CertificateManager interface {
GetCertificate(subject string, altNames []string) (*tls.Certificate, error)
}
CertificateManager defines the interface for providing certificates to a Manager.
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(wildcardDomains []string, certManager CertificateManager) *Manager
NewManager creates a new route provider. Routes should be set using the SetRoutes method after creation. Wildcard domains, if provided, MUST each have a leading dot (e.g. ".example.com").
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 ¶
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.