Documentation
¶
Index ¶
- func AddIP(configDir string, ipStr string, reason string) error
- func AddIPWithSource(configDir string, ipStr string, reason string, source string) error
- func GetBlacklistByCategory(configDir string, category string) ([]string, []string, error)
- func LoadAllBlacklists(configDir string) (map[string]bool, map[string]bool, error)
- func RemoveIP(configDir string, ipStr string) error
- func ValidateIP(ipStr string) (string, bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddIP ¶
AddIP adds an IP to the appropriate blacklist file Creates blacklist.d/99-manual.conf for manual additions Deprecated: Use AddIPWithSource for source-specific files
func AddIPWithSource ¶
AddIPWithSource adds an IP to a source-specific blacklist file Source determines the target file:
- "login" -> login-auto.conf
- "portscan" -> portscan-auto.conf
- "ddos" -> ddos-auto.conf
- "manual" -> 99-manual.conf (default)
- others -> 99-manual.conf
func GetBlacklistByCategory ¶
GetBlacklistByCategory returns IPs from a specific category file
func LoadAllBlacklists ¶
LoadAllBlacklists loads IPs from all blacklist sources: - /etc/nftban/blacklist.d/*.conf (modular files organized by category) Returns two sets: IPv4 and IPv6 addresses
Now uses optimized generic Set type from pkg/util for: - Zero memory overhead (struct{} instead of bool) - Consistent API - Better performance
Types ¶
This section is empty.