ratelimit

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ratelimit implements a rate limiting middleware

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRateLimiter added in v0.2.3

func DefaultRateLimiter() echo.MiddlewareFunc

DefaultRateLimiter returns a middleware function for rate limiting requests, see https://echo.labstack.com/docs/middleware/rate-limiter

func RateLimiterWithConfig added in v0.2.3

func RateLimiterWithConfig(conf *Config) echo.MiddlewareFunc

RateLimiterWithConfig returns a middleware function for rate limiting requests with a config supplied, see https://echo.labstack.com/docs/middleware/rate-limiter

Types

type Config added in v0.2.3

type Config struct {
	RateLimit  float64       `split_words:"true" default:"10"` // DATUM_RATE_LIMIT
	BurstLimit int           `split_words:"true" default:"30"` // DATUM_BURST_LIMIT
	ExpiresIn  time.Duration `split_words:"true" default:"1m"` // DATUM_EXPIRES_IN
}

Config defines the configuration settings for the default rate limiter

Jump to

Keyboard shortcuts

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