ratelimit

package
v0.0.0-...-15592ba Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package ratelimit is used to rate-limit requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attempt

func Attempt(ctx context.Context, user string, now time.Time, max int, interval time.Duration) error

Attempt determines if a new request by the client identified by user is allowed. An error is returned if max or more successful attempts were already made in interval. Errors can also be returned for datastore failures.

func Clear

func Clear(ctx context.Context) error

Clear deletes all rate-limiting information from datastore for testing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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