Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPScoper ¶
type IPScoper interface {
// Scope returns the identifier to use for the given context. The return value can be the plain IP
// or a network string (e.g., 2001:db8::/64) depending on configuration and IP version.
Scope(ctx ScopeContext, ip string) string
}
IPScoper abstracts normalization of IP addresses into a stable identifier for storage/lookup. Different contexts may apply different scoping rules.
func NewIPScoper ¶
func NewIPScoper() IPScoper
NewIPScoper returns a new IPScoper instance without touching configuration at init time. Configuration is consulted lazily during Scope calls to avoid early GetFile() usage in package init.
type ScopeContext ¶
type ScopeContext string
ScopeContext identifies the feature/context in which IP scoping is applied. It allows reusing the same mechanism for multiple features (e.g., repeating-wrong-password, tolerations). Keep values stable as they may be used in logs.
const ( // ScopeRepeatingWrongPassword is used when operating on password-history keys and totals. ScopeRepeatingWrongPassword ScopeContext = "repeating_wrong_password" // ScopeTolerations is used when operating on tolerations keys. ScopeTolerations ScopeContext = "tolerations" // ScopeLuaGeneric is used for generic Lua-driven features (metrics, dedup) outside brute-force. ScopeLuaGeneric ScopeContext = "lua_generic" )
Click to show internal directories.
Click to hide internal directories.