ratelimiting

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 7 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 servicediscovery.Service)

func InitRateLimiting

func InitRateLimiting()

func IsRateLimitExceeded

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

func RateLimiting

func RateLimiting(c *routing.Context) error

func RateLimitingExpirationTime

func RateLimitingExpirationTime(service servicediscovery.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 servicediscovery.Service
	ReqName string
}

Jump to

Keyboard shortcuts

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