blacklist

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIP

func AddIP(configDir string, ipStr string, reason string) error

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

func AddIPWithSource(configDir string, ipStr string, reason string, source string) error

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

func GetBlacklistByCategory(configDir string, category string) ([]string, []string, error)

GetBlacklistByCategory returns IPs from a specific category file

func LoadAllBlacklists

func LoadAllBlacklists(configDir string) (map[string]bool, map[string]bool, error)

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

func RemoveIP

func RemoveIP(configDir string, ipStr string) error

RemoveIP removes an IP from all blacklist files

func ValidateIP

func ValidateIP(ipStr string) (string, bool, error)

ValidateIP validates and normalizes an IP address Returns the normalized IP string and whether it's IPv4 Delegates to netutil.ValidateAndNormalizeIP for consistency

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL