mirror of
https://github.com/photoprism/photoprism.git
synced 2026-01-23 10:26:03 +00:00
16 lines
499 B
Go
16 lines
499 B
Go
package limiter
|
|
|
|
import (
|
|
"time"
|
|
|
|
"golang.org/x/time/rate"
|
|
)
|
|
|
|
// Default authentication rate-limit parameters.
|
|
const (
|
|
DefaultAuthInterval = time.Second * 10 // average authentication errors per second
|
|
DefaultAuthLimit = 60 // authentication failure burst rate limit (for access tokens)
|
|
)
|
|
|
|
// Auth limits the number of authentication errors from a single IP per time interval (every 15 seconds by default).
|
|
var Auth = NewLimit(rate.Every(DefaultAuthInterval), DefaultAuthLimit)
|