AuthLimits
A internal class in TavernLib, TavernLib.Backend.Auth. Reach it through att-stubs' publicized assemblies or Harmony's AccessTools.
Internal: per-address limits on the auth port and console logins. 8 failures, or 5 wrong passwords, each within 60 seconds of the last, hold an address off until 60 quiet seconds pass.
- Listed in TavernLib.Backend.Auth
- Nested types
Strikes
Constructors
| Member | What it is |
|---|---|
AuthLimits() | Created by TavernLib; mods don't make one. |
Fields
| Member | What it is |
|---|---|
const int FailLimit | 8 failures. |
const int MaxOpen | 64 open connections in all. |
const int MaxOpenPerAddress | 8 open connections from one address. |
const int PasswordFailLimit | 5 wrong passwords. |
9 private and internal fields
| Member | What it is |
|---|---|
private readonly HashSet<string> _capLogged | Addresses whose connection cap has been logged. |
private readonly Dictionary<string, AuthLimits.Strikes> _fails | Failure counts by address. |
private readonly Dictionary<string, int> _open | Open connection count by address. |
private int _openTotal | Open connections across all addresses. |
private readonly Dictionary<string, AuthLimits.Strikes> _passwordFails | Wrong password counts by address. |
private readonly object _sync | Lock around the counters. |
private bool _totalCapLogged | Whether the total connection cap has been logged. |
private const int PruneAbove | Number of tracked addresses above which stale entries are dropped. |
private static readonly TimeSpan Window | The 60 second window failures are counted in. |
Methods
2 private and internal methods
| Member | What it is |
|---|---|
private int Add(Dictionary<string, AuthLimits.Strikes> strikes, string address) | Adds a strike for an address, pruning stale entries first, and returns the new count. |
private int Count(Dictionary<string, AuthLimits.Strikes> strikes, string address) | Returns an address's recent strike count, or 0 if its last strike is outside the window. |
Used in
Members of other types that take, return or hold a AuthLimits: