whitelist

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 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) error

AddIP adds an IP to the appropriate whitelist file Creates whitelist.d/99-manual.conf for manual additions

func LoadAllWhitelists

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

LoadAllWhitelists loads IPs from all whitelist sources: - /etc/nftban/whitelist.conf (main file) - /etc/nftban/whitelist.d/*.conf (modular files) 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 whitelist files Note: This searches all .conf files and removes the IP

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