ratelimit

package
v0.6.21 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: Apache-2.0 Imports: 3 Imported by: 4 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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