Documentation
¶
Overview ¶
Package rkginlimit is a middleware of gin framework for adding rate limit in RPC response
Index ¶
Constants ¶
View Source
const ( TokenBucket = "tokenBucket" LeakyBucket = "leakyBucket" DefaultLimit = 1000000 GlobalLimiter = "rk-limiter" )
Variables ¶
This section is empty.
Functions ¶
func Interceptor ¶
func Interceptor(opts ...Option) gin.HandlerFunc
Interceptor Add rate limit interceptors.
Types ¶
type Option ¶
type Option func(*optionSet)
Option if for middleware options while creating middleware
func WithAlgorithm ¶
WithAlgorithm provide algorithm of rate limit. - tokenBucket - leakyBucket
func WithEntryNameAndType ¶
WithEntryNameAndType provide entry name and entry type.
func WithGlobalLimiter ¶
WithGlobalLimiter provide user defined Limiter.
func WithLimiterByPath ¶
WithLimiterByPath provide user defined Limiter by method.
func WithReqPerSec ¶
WithReqPerSec Provide request per second.
func WithReqPerSecByPath ¶
WithReqPerSecByPath Provide request per second by method.
Click to show internal directories.
Click to hide internal directories.