middleware

package
v0.0.0-...-79063dd Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsMiddleware

type MetricsMiddleware struct {
	Histogram metrics.Histogram
	Counter   metrics.Counter
	// contains filtered or unexported fields
}

func PrometheusMetricsMiddleware

func PrometheusMetricsMiddleware(host string) *MetricsMiddleware

func (*MetricsMiddleware) Handler

func (p *MetricsMiddleware) Handler(next http.Handler) http.Handler

type RateLimiter

type RateLimiter interface {
	Allow(user string) bool
}

type RateLimiterMiddleware

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

func NewRateLimiterMiddleware

func NewRateLimiterMiddleware(tokens int, every time.Duration) *RateLimiterMiddleware

NewRateLimiterMiddleware creates a new http middleware that honors the provided limit.

func (*RateLimiterMiddleware) Handler

func (p *RateLimiterMiddleware) Handler(next http.Handler) http.Handler

Jump to

Keyboard shortcuts

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