ratelimit

package
v0.0.0-...-31d061a Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear(ctx context.Context, remoteClient *remotecache.Client, endpoint string) error

Clear the specified remote entry

func Endpoint

func Endpoint(ctx context.Context, endpoint string, rateLimit int, anonymousOnly bool) error

Endpoint protects a specific endpoint from public clients

func Middleware

func Middleware() gin.HandlerFunc

Middleware protects the API globally from anonymous requests

func Remote

func Remote(ctx context.Context, remoteClient *remotecache.Client, endpoint string, rateLimit int, anonymousOnly bool) error

Remote protects a specific endpoint from public clients, with remote client

Types

type RateLimit

type RateLimit struct {
	Increment int
}

RateLimit contains basic data for limit options

Jump to

Keyboard shortcuts

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