ratelimit

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Overview

Package ratelimit implements a rate limiting middleware

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RateLimiterWithConfig

func RateLimiterWithConfig(conf *Config) echo.MiddlewareFunc

RateLimiterWithConfig returns a middleware function for rate limiting requests with a config supplied

Types

type Config

type Config struct {
	Enabled    bool          `json:"enabled" koanf:"enabled" default:"false"`
	RateLimit  float64       `json:"limit" koanf:"limit" default:"10"`
	BurstLimit int           `json:"burst" koanf:"burst" default:"30"`
	ExpiresIn  time.Duration `json:"expires" koanf:"expires" default:"10m"`
}

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