Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoginAttemptLimiter ¶
type LoginAttemptLimiter struct {
// contains filtered or unexported fields
}
LoginAttemptLimiter ログイン試行専用のレート制限
func NewLoginAttemptLimiter ¶
func NewLoginAttemptLimiter(rateLimiter RateLimiter, maxAttempts int, window time.Duration) *LoginAttemptLimiter
NewLoginAttemptLimiter 新しいLoginAttemptLimiterを作成
func (*LoginAttemptLimiter) CheckAttempt ¶
func (l *LoginAttemptLimiter) CheckAttempt(ctx context.Context, identifier string) (bool, int, time.Duration, error)
CheckAttempt ログイン試行が許可されているかチェック
func (*LoginAttemptLimiter) ResetAttempts ¶
func (l *LoginAttemptLimiter) ResetAttempts(ctx context.Context, identifier string) error
ResetAttempts 指定された識別子のログイン試行回数をリセット
type RateLimiter ¶
type RateLimiter interface {
// IsAllowed 指定されたキーに対してアクションが許可されているかチェック
IsAllowed(ctx context.Context, key string, limit int, window time.Duration) (bool, int, time.Duration, error)
// Reset 指定されたキーのレート制限をリセット
Reset(ctx context.Context, key string) error
}
RateLimiter Redisベースのレート制限インターフェース
func NewRedisRateLimiter ¶
func NewRedisRateLimiter(client rueidis.Client) RateLimiter
NewRedisRateLimiter 新しいRedisRateLimiterを作成
type RedisRateLimiter ¶
type RedisRateLimiter struct {
// contains filtered or unexported fields
}
RedisRateLimiter Redisを使用したレート制限実装
type RegisterAttemptLimiter ¶
type RegisterAttemptLimiter struct {
// contains filtered or unexported fields
}
RegisterAttemptLimiter 登録試行専用のレート制限
func NewRegisterAttemptLimiter ¶
func NewRegisterAttemptLimiter(rateLimiter RateLimiter, maxAttempts int, window time.Duration) *RegisterAttemptLimiter
NewRegisterAttemptLimiter 新しいRegisterAttemptLimiterを作成
func (*RegisterAttemptLimiter) CheckAttempt ¶
func (r *RegisterAttemptLimiter) CheckAttempt(ctx context.Context, identifier string) (bool, int, time.Duration, error)
CheckAttempt 登録試行が許可されているかチェック
func (*RegisterAttemptLimiter) ResetAttempts ¶
func (r *RegisterAttemptLimiter) ResetAttempts(ctx context.Context, identifier string) error
ResetAttempts 指定された識別子の登録試行回数をリセット
Click to show internal directories.
Click to hide internal directories.