persistence

package
v1.0.27 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnpersistBan

func UnpersistBan(configDir, ip string) (int, error)

UnpersistBan removes an IP from all blacklist files. Uses flock for safe concurrent access.

Returns the number of files modified and any error.

Types

type Result

type Result string

Result indicates the outcome of a persistence operation

const (
	Created        Result = "created"
	AlreadyPresent Result = "already_present"
)

func PersistBan

func PersistBan(configDir, ip, reason, source string) (Result, string, error)

PersistBan adds an IP to the persistent blacklist files. Uses flock for safe concurrent access.

Parameters:

  • configDir: base config directory (e.g., /etc/nftban)
  • ip: normalized IP address (must be valid)
  • reason: ban reason (optional)
  • source: determines target file (login/portscan/ddos/persistent/manual)

Returns:

  • Result: Created or AlreadyPresent
  • string: filename that was written to
  • error: on I/O failure or invalid input

Jump to

Keyboard shortcuts

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