Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
Wrapper around Go's rate.Limiter that supports both global and a per-sender rate limiting.
func NewRateLimiter ¶
func NewRateLimiter(config RateLimiterConfig) (*RateLimiter, error)
func (*RateLimiter) Allow ¶
func (rl *RateLimiter) Allow(sender string) bool
Allow checks that the sender is not rate limited, and that there is not a global rate limit.
func (*RateLimiter) AllowVerbose ¶
func (rl *RateLimiter) AllowVerbose(sender string) (senderAllow bool, globalAllow bool)
Allow checks that the sender is not rate limited, and that there is not a global rate limit. Returns if allowed as separate outputs.
Click to show internal directories.
Click to hide internal directories.