Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMissingCACert = errors.New("missing required CA certificate")
ErrMissingCACert represents an error caused by server config that requires certificate verification, but is missing a CA certificate
Functions ¶
func LoadCertPoolFromPkcs7Package ¶
LoadCertPoolFromPkcs7Package reads the certificates in a DER-encoded PKCS7 package and returns a newly-created x509.CertPool with those Certificates added.
func NamedServerFromContext ¶
NamedServerFromContext returns name name of the server that was previously added into the context, if any.
Types ¶
type CreateNamedServerInput ¶
type CreateNamedServerInput struct { Name string Host string Port int Logger *zap.Logger HTTPHandler http.Handler ClientAuth tls.ClientAuthType Certificates []tls.Certificate ClientCAs *x509.CertPool // CaCertPool }
CreateNamedServerInput contains the input for the CreateServer function.
type NamedServer ¶
type NamedServer struct { *http.Server Name string IsServerReady bool IsServerReadyMutex sync.Mutex }
NamedServer wraps *http.Server to override the definition of ListenAndServeTLS, but bypasses some restrictions.
func CreateNamedServer ¶
func CreateNamedServer(input *CreateNamedServerInput) (*NamedServer, error)
CreateNamedServer returns a no-tls, tls, or mutual-tls Server based on the input given and an error, if any.
func (*NamedServer) IsReady ¶
func (s *NamedServer) IsReady() bool
IsReady returns if a server is ready
func (*NamedServer) ListenAndServeTLS ¶
func (s *NamedServer) ListenAndServeTLS() error
ListenAndServeTLS is similar to (*http.Server).ListenAndServeTLS, but bypasses some restrictions.
func (*NamedServer) Port ¶
func (s *NamedServer) Port() int
Port returns the port the server binds to. Returns -1 if any error.
func (*NamedServer) WaitUntilReady ¶
func (s *NamedServer) WaitUntilReady()
WaitUntilReady waits until the server is ready