# Functions
AccessLog adds an access logging middleware.
AccessLogHandler returns a http.Handler that adds access-logging on the info level.
AccessMetrics collects metrics about bytes send and response status codes and writes them to the provided prometheus registerer.
AccessMetricsHandler collects the bytes send out as well as the status codes as prometheus metrics and writes them to the registry.
AccessMetricsRegister registrates the relevant prometheus types and returns a custom registration type.
AddGracefulShutdown intercepts the cancel function of the received ctx and calls the shutdowner.Shutdown interface instead.
Build a http server from the provided options.
Caching adds a caching middleware handler which uses the ETag HTTP response and If-None-Match HTTP request headers.
CspReplace has the hard requirement that a session cookie is present in the context, see server.SessionCookie to add one.
FileServerHandler implements the actual fileserver logic.
Gzip adds an on-demand gzipping middleware.
GzipHandler is a handler that compressed responses if the HTTP Content-Type response header is part of the gzipMediaTypes and if the request has the Accept-Encoding=gzip HTTP request Header set.
H@C adds a middleware that supports h2c (unencrypted http2).
Header adds a static HTTP header adding middleware.
HealthCheckConditionalHandler is a conditional healthcheck handler that returns HTTP 200 when the condition argument function returns true and HTTP 503 if not.
HealthCheckHandler is a dummy handler that always returns HTTP 200.
NewCacheHandler computes and stores the hashes for all files.
Optional sets the middleware if the isActive condition is fulfilled.
ReplacerCollectionFromInput constructs a replacer that prepares the input data into a template where the toReplace string will be replaced.
RequestID adds a middleware that adds a randomly generated request id to the request context.
RequestIdToCtxHandler generates a random request-id and adds it to the request context under the RequestIdKey.
RunTillWaitGroupFinishes runs the server argument until the WaitGroup wg finishes.
SessionCookieHandler reads the cookieName cookie from the request and adds if to the context unter the SessionIdKey if present.
SessionId adds a session cookie adding middleware.
SigTermCtx intercepts the syscall.SIGTERM and returns the information in the form of a wrapped context whose cancel function is called when the SIGTERM signal is received.
Timer adds a middleware that adds a started timer to the request context for time measuring purposes.
TimerStartToCtxHandler starts a timer and adds it to the request context under the TimerKey key.
ValidateClean adds to the validate middleware and prevent path transversal attacks by cleaning the request path.
ValidateCleanHandler returns HTTP 405 if the request method is not GET or HEAD.
# Constants
CspHeaderName is the Content-Security-Policy HTTP-Header name.
# Variables
No description provided by the author
RequestIdKey is the context key used for storing the request id in the request context.
No description provided by the author
SessionIdKey is the ContextKey under which the current sessionId can be found.
No description provided by the author
TimerKey is the ContextKey under which the timing start time.Time can be found.
# Structs
AngularCspReplaceConfig holds the config options for fixing the syle-src CSP issue in Angular.
Config holds the advanced server config options.
ContextKey is a struct used for storing relevant keys in the request context.
CspReplaceHandler implements the http.Handler interface and fixes the Angular style-src CSP issue.
HeaderHandler implements the http.Handler interface and adds the static headers provided in the Headers map to the response.
PrometheusRegistration wraps a prometheus registerer and corresponding registered types.
ReplacerCollection is a series of replacer implementations which are used to effectively replace a given string by pre-splitting the target template.
# Interfaces
Shutdowner are functions that support a Shutdown operation.
# Type aliases
HandlerMiddleware wraps a received handler with another wrapper handler to add functionality.