middleware

package
v5.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHeadersFromContext

func GetHeadersFromContext(ctx context.Context) (http.Header, bool)

GetHeadersFromContext returns http.Header from context.

func HeadersToContext

func HeadersToContext(h http.Handler) http.Handler

HeadersToContext puts HTTP headers to request context.

func LogRequest

func LogRequest(h http.Handler) http.Handler

LogRequest middleware logs details of request.

func Post

func Post(h http.Handler) http.Handler

Post checks that handler called via POST HTTP method.

func SetHeadersToContext

func SetHeadersToContext(ctx context.Context, h http.Header) context.Context

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

func (*CORS) Middleware

func (c *CORS) Middleware(h http.Handler) http.Handler

type ConnLimit

type ConnLimit struct {
	// contains filtered or unexported fields
}

func NewConnLimit

func NewConnLimit(node *centrifuge.Node, ruleContainer *rule.Container) *ConnLimit

func (*ConnLimit) Middleware

func (l *ConnLimit) Middleware(h http.Handler) http.Handler

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

type OriginCheck

type OriginCheck func(r *http.Request) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL