Documentation
¶
Overview ¶
Package ratelimit provides an interface and implementation for rate limiting functionality, specifically for OTP requests in the authentication flow. It defines the RatelimitStore interface and a Redis-based implementation to track and enforce request limits based on email addresses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryRateLimitStore ¶
type MemoryRateLimitStore struct {
// contains filtered or unexported fields
}
MemoryRateLimitStore holds the state for the in-memory rate limiters.
func NewMemoryRateLimitStore ¶
func NewMemoryRateLimitStore(cleanupInterval time.Duration) *MemoryRateLimitStore
NewMemoryRateLimitStore creates a new store and starts the cleanup goroutine.
func (*MemoryRateLimitStore) Allow ¶
func (s *MemoryRateLimitStore) Allow(ctx context.Context, key string, limit int, period time.Duration) (bool, time.Duration, error)
Allow implements domain.RateLimitStore.
func (*MemoryRateLimitStore) Close ¶
func (s *MemoryRateLimitStore) Close()
Close stops the cleanup goroutine.
Click to show internal directories.
Click to hide internal directories.