middleware

package
v5.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const EndpointKey = "ep"

EndpointKey is used to set the endpoint for latency tracker within the request handler

Variables

This section is empty.

Functions

func SetEndpoint added in v5.0.4

func SetEndpoint(ctx *gin.Context)

SetEndpoint stores the endpoint in the context for future middleware querying

Types

type APIKeyValidator

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

APIKeyValidator is a small component that validates apikeys

func NewAPIKeyValidator

func NewAPIKeyValidator(apikeys []string) *APIKeyValidator

NewAPIKeyValidator instantiates an apikey validation component

func (*APIKeyValidator) AsMiddleware

func (v *APIKeyValidator) AsMiddleware(ctx *gin.Context)

AsMiddleware is a function to be used as a gin middleware

func (*APIKeyValidator) IsValid

func (v *APIKeyValidator) IsValid(apikey string) bool

IsValid checks if an apikey is valid

type MetricsMiddleware added in v5.0.4

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

MetricsMiddleware is meant to be used for capturing endpoint latencies and return status codes

func NewProxyMetricsMiddleware added in v5.0.4

func NewProxyMetricsMiddleware(lats storage.ProxyEndpointTelemetry) *MetricsMiddleware

NewProxyMetricsMiddleware instantiates a new local-telemetry tracking middleware

func (*MetricsMiddleware) Track added in v5.0.4

func (m *MetricsMiddleware) Track(ctx *gin.Context)

Track is the function to be invoked for every request being handled

Jump to

Keyboard shortcuts

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