limiter

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package limiter provides a simple limiter middleware.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter added in v0.0.3

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

Limiter represents a limiter middleware.

func New added in v0.0.3

func New(key func(*ws.Context) interface{}) *Limiter

New creates a new limiter middleware.

func (*Limiter) Check added in v0.0.3

func (a *Limiter) Check(ctx *ws.Context) error

Check checks the limiter.

func (*Limiter) Rate added in v0.0.3

func (a *Limiter) Rate(d time.Duration, c int) *Limiter

Rate limits the request rate.

func (*Limiter) Size added in v0.0.3

func (a *Limiter) Size(n int64) *Limiter

Size limits the request body size.

Jump to

Keyboard shortcuts

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