ratelimiting

package
v0.0.0-...-9b02830 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRateLimitingMetricName

func GetRateLimitingMetricName(c *routing.Context, limiter config.GApiRateLimitingConfig) string

func IncrementRateLimiting

func IncrementRateLimiting(currentRequestMetricName string, service service.Service)

func InitRateLimiting

func InitRateLimiting()

func IsRateLimitExceeded

func IsRateLimitExceeded(rateStatus RateStatus, service service.Service) bool

func RateLimiting

func RateLimiting(c *routing.Context) error

func RateLimitingExpirationTime

func RateLimitingExpirationTime(service service.Service) int64

Types

type LimiterRate

type LimiterRate struct {
	Period time.Duration
	Limit  int
}

type RateStatus

type RateStatus struct {
	NumberRequests int
	ExpirationTime int64
}

func RateLimitingStatusForRequest

func RateLimitingStatusForRequest(currentRequestMetricName string) RateStatus

type Updater

type Updater struct {
	NewRate RateStatus
	Service service.Service
	ReqName string
}

Jump to

Keyboard shortcuts

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