ratelimit

package
v0.5.24 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLimitExceed = errors.New(429, "service unavailable due to rate limit exceeded")

ErrLimitExceed is service unavailable due to rate limit exceeded.

Functions

func NewBuilder

func NewBuilder() middleware.MiddlewareBuilder

func Server

func Server(opts ...Option) middleware.Middleware

Server ratelimiter middleware

Types

type Config

type Config struct {
	Limiter string `json:"limiter" yaml:"limiter"`
}

type Option

type Option func(*options)

Option is ratelimit option.

func WithLimiter

func WithLimiter(limiter ratelimit.Limiter) Option

WithLimiter set Limiter implementation, default is bbr limiter

Jump to

Keyboard shortcuts

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