Documentation
¶
Index ¶
- func GetHeadersFromContext(ctx context.Context) (http.Header, bool)
- func HTTPServerInstrumentation(next http.Handler) http.Handler
- func HeadersToContext(h http.Handler) http.Handler
- func LogRequest(h http.Handler) http.Handler
- func Post(h http.Handler) http.Handler
- func SetHeadersToContext(ctx context.Context, h http.Header) context.Context
- func UserHeaderAuth(userHeaderName string) func(http.Handler) http.Handler
- type APIKeyAuth
- type CORS
- type ConnLimit
- type OpenTelemetryHandler
- type OriginCheck
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHeadersFromContext ¶
GetHeadersFromContext returns http.Header from context.
func HTTPServerInstrumentation ¶
HTTPServerInstrumentation is a middleware to instrument HTTP handlers. Since it adds and extra layer of response wrapping Centrifugo doesn't use it by default. Note, we can not simply collect durations here because we have handlers with long-lived connections which require special care. So for now we just count requests.
func HeadersToContext ¶
HeadersToContext puts HTTP headers to request context.
func LogRequest ¶
LogRequest middleware logs details of request.
func SetHeadersToContext ¶
Types ¶
type APIKeyAuth ¶
type APIKeyAuth struct {
// contains filtered or unexported fields
}
APIKeyAuth middleware authorizes request using API key authorization. It first tries to use Authorization header to extract API key (Authorization: apikey <KEY>), then checks for api_key URL query parameter. If key not found or invalid then 401 response code is returned.
func NewAPIKeyAuth ¶
func NewAPIKeyAuth(key string) *APIKeyAuth
func (*APIKeyAuth) Middleware ¶
func (a *APIKeyAuth) Middleware(h http.Handler) http.Handler
type CORS ¶
type CORS struct {
// contains filtered or unexported fields
}
CORS middleware.
func NewCORS ¶
func NewCORS(originCheck OriginCheck) *CORS
type ConnLimit ¶
type ConnLimit struct {
// contains filtered or unexported fields
}
func NewConnLimit ¶
func NewConnLimit(node *centrifuge.Node, cfgContainer *config.Container) *ConnLimit
type OpenTelemetryHandler ¶
type OpenTelemetryHandler struct {
// contains filtered or unexported fields
}
func NewOpenTelemetryHandler ¶
func NewOpenTelemetryHandler(operation string, opts []otelhttp.Option) *OpenTelemetryHandler
func (*OpenTelemetryHandler) Middleware ¶
func (t *OpenTelemetryHandler) Middleware(h http.Handler) http.Handler