banlog

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package banlog provides centralized ban logging for NFTBan All ban actions (from any source) should log here for stats tracking

Index

Constants

View Source
const (
	SourceManual   = "manual"
	SourceLogin    = "login"
	SourcePortscan = "portscan"
	SourceDDoS     = "ddos"
	SourceFeeds    = "feeds"
	SourceSuricata = "suricata"
	SourceFail2ban = "fail2ban" // Legacy compatibility
)

Source constants for ban log entries

View Source
const (
	StatusBanned   = "BANNED"
	StatusUnbanned = "UNBANNED"
)

Status constants

Variables

This section is empty.

Functions

func LogBan

func LogBan(ip, source, country string) error

LogBan writes a ban entry to the central ban.log Parameters:

  • ip: IP address being banned
  • source: Ban source (manual, login, portscan, ddos, feeds, suricata)
  • country: Country code (e.g., "US", "CN", "UNK" if unknown)

Format: DATE|TIME|SOURCE|IP|COUNTRY|BANNED

func LogBanWithReason

func LogBanWithReason(ip, source, country, reason string) error

LogBanWithReason writes a ban entry with an optional reason (stored in extended format) This is for detailed logging - the reason is NOT used by stats but is useful for audit

func LogUnban

func LogUnban(ip, source, country string) error

LogUnban writes an unban entry to the central ban.log Parameters:

  • ip: IP address being unbanned
  • source: Unban source (usually "manual")
  • country: Country code

Format: DATE|TIME|SOURCE|IP|COUNTRY|UNBANNED

Types

This section is empty.

Jump to

Keyboard shortcuts

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