ratelimiter

package
v0.0.0-...-8ac232a Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

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

func (Info) IsExceeded

func (i Info) IsExceeded() bool

func (Info) Limit

func (i Info) Limit() int64

func (Info) Remaining

func (i Info) Remaining() int64

func (Info) Resets

func (i Info) Resets() time.Duration

type RateLimiter

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

func New

func New(client *redis.Client, rate int64, duration time.Duration) *RateLimiter

func (*RateLimiter) AddAndCheckIfExceeds

func (r *RateLimiter) AddAndCheckIfExceeds(ctx context.Context, ip net.IP) (Info, error)

Jump to

Keyboard shortcuts

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