Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRemoteIP ¶
GetRemoteIP returns the ip of requester Don't care if the ip is real or not
Types ¶
type CaddyLimiter ¶
func NewCaddyLimiter ¶
func NewCaddyLimiter() *CaddyLimiter
func (*CaddyLimiter) Allow ¶
func (cl *CaddyLimiter) Allow(keys []string, rule Rule) bool
Allow is just a shortcut for AllowN
func (*CaddyLimiter) AllowN ¶
func (cl *CaddyLimiter) AllowN(keys []string, rule Rule, n int) bool
AllowN check if n count are allowed for a specific key
func (*CaddyLimiter) RetryAfter ¶
func (cl *CaddyLimiter) RetryAfter(keys []string) time.Duration
RetryAfter return a helper message for client
type RateLimit ¶
type RateLimit struct { Next httpserver.Handler Rules []Rule }
RateLimit is an http.Handler that can limit request rate to specific paths or files
Click to show internal directories.
Click to hide internal directories.