Versions in this module Expand all Collapse all v1 v1.0.0 Mar 21, 2026 Changes in this version + type DatabaseProvider struct + func NewDatabaseProvider(db bun.IDB) (*DatabaseProvider, error) + func NewDatabaseProviderWithConfig(db bun.IDB, config DatabaseStorageConfig) (*DatabaseProvider, error) + func (p *DatabaseProvider) CheckAndIncrement(ctx context.Context, key string, window time.Duration, maxRequests int) (bool, int, time.Time, error) + func (p *DatabaseProvider) Close() error + func (p *DatabaseProvider) GetName() string + type DatabaseStorageConfig struct + CleanupInterval time.Duration + type InMemoryProvider struct + func NewInMemoryProvider() *InMemoryProvider + func NewInMemoryProviderWithConfig(config MemoryStorageConfig) *InMemoryProvider + func (p *InMemoryProvider) CheckAndIncrement(ctx context.Context, key string, window time.Duration, maxRequests int) (bool, int, time.Time, error) + func (p *InMemoryProvider) Close() error + func (p *InMemoryProvider) GetName() string + type MemoryStorageConfig struct + CleanupInterval time.Duration + type RateLimit struct + Count int + ExpiresAt time.Time + Key string + type RateLimitCheckRequest struct + ClientIP string + HTTPMethod string + Path string + type RateLimitCheckResponse struct + Allowed bool + Limit int + RetryAfter int + Window int + type RateLimitEntry struct + Count int + FirstReq time.Time + LastReset time.Time + type RateLimitHookHandler struct + func NewRateLimitHookHandler(config *models.Config, logger models.Logger, ...) *RateLimitHookHandler + func (h *RateLimitHookHandler) Handle() models.HookHandler + type RateLimitPlugin struct + func New(config RateLimitPluginConfig) *RateLimitPlugin + func (p *RateLimitPlugin) Close() error + func (p *RateLimitPlugin) Config() any + func (p *RateLimitPlugin) DependsOn() []string + func (p *RateLimitPlugin) Hooks() []models.Hook + func (p *RateLimitPlugin) Init(ctx *models.PluginContext) error + func (p *RateLimitPlugin) Metadata() models.PluginMetadata + func (p *RateLimitPlugin) Migrations(provider string) []migrations.Migration + func (p *RateLimitPlugin) OnConfigUpdate(config *models.Config) error + type RateLimitPluginConfig struct + CustomRules map[string]RateLimitRule + Database *DatabaseStorageConfig + Enabled bool + Max int + Memory *MemoryStorageConfig + Prefix string + Provider RateLimitProviderType + Window time.Duration + func (config *RateLimitPluginConfig) ApplyDefaults() + type RateLimitProvider interface + CheckAndIncrement func(ctx context.Context, key string, window time.Duration, maxRequests int) (bool, int, time.Time, error) + Close func() error + GetName func() string + type RateLimitProviderType string + const RateLimitProviderDatabase + const RateLimitProviderInMemory + const RateLimitProviderRedis + func (r RateLimitProviderType) String() string + type RateLimitRepository interface + CleanupExpired func(ctx context.Context, now time.Time) error + GetByKey func(ctx context.Context, key string) (*RateLimit, error) + UpdateOrCreate func(ctx context.Context, key string, window time.Duration) (*RateLimit, error) + func NewRateLimitRepository(db bun.IDB) RateLimitRepository + type RateLimitRule struct + Disabled bool + Max int + Prefix string + Window time.Duration + type SecondaryStorageProvider struct + func NewSecondaryStorageProvider(name string, storage models.SecondaryStorage) *SecondaryStorageProvider + func (p *SecondaryStorageProvider) CheckAndIncrement(ctx context.Context, key string, window time.Duration, maxRequests int) (bool, int, time.Time, error) + func (p *SecondaryStorageProvider) Close() error + func (p *SecondaryStorageProvider) GetName() string