ratelimit

package module
v0.0.0-...-a0bf5f9 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 8 Imported by: 0

README

ratelimit

Implementation

a rate limiter based on leaky bucket algorithm.

Install

go get "github.com/shekhar-kamble/ratelimit"

Example

https://gist.github.com/shekhar-kamble/ec775ae8cb4057367a023110d2fb2315

Documentation

Index

Constants

View Source
const MaxLimit = math.MaxInt64

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

func New

func New(limit int64, duration int64) (limiter *Limiter, err error)

func (*Limiter) Allow

func (lim *Limiter) Allow(key string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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