geoban

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: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BanFilePrefix is the prefix for ban config files
	BanFilePrefix = "50-ban-"

	// WhitelistFilePrefix is the prefix for whitelist config files
	WhitelistFilePrefix = "50-whitelist-"
)

Variables

This section is empty.

Functions

func Build

func Build(geobanDir string, countries []string) (*model.SetData, error)

Build loads all geoban country files and returns consolidated SetData This replaces the slow bash implementation with fast Go parsing

Performance: <2s for 2,259 CIDRs (vs 120s timeout in bash)

Features: - Reads from /etc/nftban/geoban.d/50-ban-*.conf files - IPv4/IPv6 automatic separation - CIDR normalization - Comment and empty line filtering - Streaming parsing (memory efficient)

func ListBannedCountries

func ListBannedCountries(geobanDir string) ([]string, error)

ListBannedCountries returns list of currently banned countries

func ListWhitelistedCountries

func ListWhitelistedCountries(geobanDir string) ([]string, error)

ListWhitelistedCountries returns list of currently whitelisted countries

Types

type Stats

type Stats struct {
	Countries     int
	TotalCIDRs    int
	IPv4CIDRs     int
	IPv6CIDRs     int
	BannedList    []string
	WhitelistList []string
}

Stats returns statistics about geoban data

func GetStats

func GetStats(geobanDir string) (*Stats, error)

GetStats returns statistics about current geoban configuration

Jump to

Keyboard shortcuts

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