Documentation
¶
Overview ¶
Package cache provides rate limiting and temporary throttle helpers for device authorization. The persistent store remains the authoritative source of truth for all device grant state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimiter ¶
type RateLimiter interface {
// Allow checks if the request with key is within limit for window.
Allow(ctx context.Context, key string, limit int64, window time.Duration) (bool, error)
}
RateLimiter provides rate limiting checks to prevent brute-forcing user codes.
func NewRateLimiter ¶
func NewRateLimiter(c corecache.Cache) RateLimiter
NewRateLimiter creates a RateLimiter wrapping Core's cache adapter or an in-memory fallback.
Click to show internal directories.
Click to hide internal directories.