Help us shape the future of Go! Take the 2026 Go Developer Survey

authlimit

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT-0 Imports: 2 Imported by: 0

Documentation

Overview

Package authlimit provides a small in-memory login failure limiter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

Limiter blocks repeated failed logins for the same key within a window.

func New

func New(max int, window time.Duration) *Limiter

New returns a limiter that blocks after max failures within window.

func (*Limiter) Allowed

func (l *Limiter) Allowed(key string) bool

Allowed reports whether key may attempt authentication now.

func (*Limiter) Failure

func (l *Limiter) Failure(key string)

Failure records a failed attempt.

func (*Limiter) Success

func (l *Limiter) Success(key string)

Success clears the failure history for key.

Jump to

Keyboard shortcuts

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