Documentation
¶
Overview ¶
Package throttle makes an address wait longer after each try in a row: wrong passwords at the login and on the OAuth consent page, accounts created from one address at the public sign-up. The failures are kept in the base (login_failures): a restart forgets none, and /authorize faces the Internet.
Index ¶
Constants ¶
const GlobalKey = "global consent"
GlobalKey counts the wrong passwords of every address on the OAuth consent page, which faces the Internet: an attacker rotating addresses still waits. The login stays on the tailnet and does not count it.
Variables ¶
This section is empty.
Functions ¶
func AddressKey ¶
AddressKey is the key of the request's client: its IPv4 address, or the /64 of an IPv6 one, which one client usually holds whole.
Types ¶
type Throttle ¶
type Throttle struct {
// contains filtered or unexported fields
}
Throttle counts the tries in a row of each key, under its name.
func New ¶ added in v0.6.0
New gives a throttle whose keys are counted under name, and whose 429 says message.
func Passwords ¶
Passwords counts the wrong passwords: the login and the OAuth consent page share the count of an address. No name: its keys stay those the base already holds.
func Signups ¶ added in v0.6.0
Signups counts the accounts an address creates in the public mode: one address cannot fill the server.
func (*Throttle) Blocked ¶
Blocked answers 429 with Retry-After while key waits, else counts the try (Try).