loginlimit

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigKeyLoginFailureLimit = "security.account_lock.failure_limit"
	ConfigKeyLookbackTime      = "security.account_lock.lookback_time"
	ConfigKeyLockDuration      = "security.account_lock.lock_duration"

	DefaultFailureLimit        = 5
	DefaultLookbackTime        = 15 * time.Minute
	DefaultAccountLockDuration = 15 * time.Minute
)

Variables

View Source
var (
	ErrAccountLocked = errors.New("loginlimit: account is locked")
)

Functions

This section is empty.

Types

type InMemoryLoginLimiter

type InMemoryLoginLimiter struct {
	// contains filtered or unexported fields
}

func NewInMemoryLimiter

func NewInMemoryLimiter() *InMemoryLoginLimiter

func (*InMemoryLoginLimiter) IsAccountLocked

func (iml *InMemoryLoginLimiter) IsAccountLocked(key string) bool

func (*InMemoryLoginLimiter) MarkFailedAttempt

func (iml *InMemoryLoginLimiter) MarkFailedAttempt(key string) (int, error)

func (*InMemoryLoginLimiter) MarkSuccessfulAttempt

func (iml *InMemoryLoginLimiter) MarkSuccessfulAttempt(key string)

type LoginLimiter

type LoginLimiter interface {
	IsAccountLocked(key string) bool
	MarkFailedAttempt(key string) (int, error)
	MarkSuccessfulAttempt(key string)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL