ratelimit

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 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 LimiterStore added in v1.6.1

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

LimiterStore is a specialized store for rate limiters It uses a simple circular buffer approach to avoid expensive evictions

func NewLimiterStore added in v1.6.1

func NewLimiterStore(maxSize, rateLimit int) *LimiterStore

NewLimiterStore creates a new limiter store

func (*LimiterStore) Cleanup added in v1.6.1

func (s *LimiterStore) Cleanup(olderThan time.Duration)

Cleanup removes entries older than duration

func (*LimiterStore) Get added in v1.6.1

func (s *LimiterStore) Get(key uint64) *limiter

Get retrieves or creates a limiter for the given key

func (*LimiterStore) Len added in v1.6.1

func (s *LimiterStore) Len() int

Len returns the number of limiters

type RateLimit

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

RateLimit type.

func New

func New(cfg *config.Config) *RateLimit

New return accesslist.

func (*RateLimit) Name

func (r *RateLimit) Name() string

(*RateLimit).Name name return middleware name.

func (*RateLimit) ServeDNS

func (r *RateLimit) ServeDNS(ctx context.Context, ch *middleware.Chain)

(*RateLimit).ServeDNS serveDNS implements the Handle interface.

Jump to

Keyboard shortcuts

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