Documentation ¶
Index ¶
Constants ¶
View Source
const Version = "1.0.1"
Version is ratelimiter's version
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // Key prefix, default is "LIMIT:". Prefix string // The max count in duration for no policy, default is 100. Max int // Count duration for no policy, default is 1 Minute. Duration time.Duration // Policy is a map of custom limiter policy. Policy map[string][]int // GetID returns limiter id for a request. GetID func(ctx *gear.Context) string // Use a redis client for limiter, if omit, it will use a memory limiter. Client baselimiter.RedisClient }
Options for Limiter
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter ...
Click to show internal directories.
Click to hide internal directories.