Documentation ¶
Index ¶
- type Limiter
- func NewCookieKeyModeLimiter(rate float64, capacity int64, cookieKey string) *Limiter
- func NewGlobalModeLimiter(rate float64, capacity int64) *Limiter
- func NewHeaderKeyModeLimiter(rate float64, capacity int64, headerKey string) *Limiter
- func NewRemoteIPModeLimiter(rate float64, capacity int64) *Limiter
- type Mode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter is the structure for request rate limiter
func NewCookieKeyModeLimiter ¶
NewCookieKeyModeLimiter todo
func NewGlobalModeLimiter ¶
NewGlobalModeLimiter todo
func NewHeaderKeyModeLimiter ¶
NewHeaderKeyModeLimiter todo
func NewRemoteIPModeLimiter ¶
NewRemoteIPModeLimiter todo
func (*Limiter) GetLimiter ¶
func (l *Limiter) GetLimiter(r *http.Request) flowcontrol.RateLimiter
GetLimiter 获取对应的限制器
func (*Limiter) SetRemoteIPHeader ¶
SetRemoteIPHeader 设置RemoteIP的头
Click to show internal directories.
Click to hide internal directories.