rate

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

func NewLimiter

func NewLimiter(opt ...Option) *Limiter

func (*Limiter) AllowN

func (l *Limiter) AllowN(key string, maxn int64, dur time.Duration, n int64, deduplicationID string) (allocated int64, expiration time.Duration, allow bool)

type Option

type Option func(o *Options)

func Addr

func Addr(addr string) Option

func Fallback

func Fallback(f *rate.Limiter) Option

func Password

func Password(pw string) Option

func PoolSize

func PoolSize(size int) Option

func Window

func Window(windowType WindowType) Option

type Options

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

func DefaultOptions

func DefaultOptions() *Options

type WindowType

type WindowType int
const (
	WindowFixedSET WindowType = iota
	WindowFixedHSET
	WindowRolling
)

Jump to

Keyboard shortcuts

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