ui

package
v1.8.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Layout

func Layout(title string) templ.Component

Layout renders the base HTML structure (login page)

func LayoutWithNav

func LayoutWithNav(title string, activePage string) templ.Component

LayoutWithNav renders pages with sidebar navigation

func LayoutWithNavAndCSRF added in v1.8.7

func LayoutWithNavAndCSRF(title string, activePage string, csrfToken string) templ.Component

LayoutWithNavAndCSRF renders pages with sidebar and CSRF protection

Types

type AlertMetrics added in v1.6.1

type AlertMetrics struct {
	SID       string
	Signature string
	Count     int
	Severity  string
}

AlertMetrics holds alert statistics

type BanEntry added in v1.2.3

type BanEntry struct {
	IP          string
	Type        string // "permanent", "temporary", "feed", "geoban"
	Reason      string
	Module      string // login, portscan, ddos, manual, feed
	Country     string
	CountryCode string
	BannedAt    string
	ExpiresAt   string // Empty for permanent
	Source      string // Config file or feed name
}

BanEntry represents a single banned IP

type BansData added in v1.2.3

type BansData struct {
	// Summary stats
	TotalBans int
	BansIPv4  int
	BansIPv6  int
	TempBans  int
	PermBans  int
	FeedBans  int
	GeoBans   int

	// Ban list
	Bans []BanEntry

	// Pagination
	Page       int
	PageSize   int
	TotalPages int

	// Filters
	Filter      string // "all", "temp", "perm", "feed", "geo"
	SearchQuery string
}

BansData holds all ban list information

type BinaryInfo added in v1.1.1

type BinaryInfo struct {
	Name    string
	Path    string
	Version string
	Size    string
}

BinaryInfo represents an installed binary

type CPUInfo added in v1.6.1

type CPUInfo struct {
	Model        string
	Cores        int
	Threads      int
	Frequency    string
	UsagePercent float64
	LoadAvg1     float64
	LoadAvg5     float64
	LoadAvg15    float64
}

CPUInfo holds CPU information

type ConfigInfo added in v1.1.1

type ConfigInfo struct {
	Name     string
	Path     string
	Modified string
	Size     string
}

ConfigInfo represents a configuration file

type ConnectionInfo added in v1.6.1

type ConnectionInfo struct {
	Protocol   string // "tcp", "udp"
	LocalAddr  string
	RemoteAddr string
	State      string
	PID        int
	Process    string
}

ConnectionInfo holds connection information

type CountryMetrics added in v1.6.1

type CountryMetrics struct {
	Code       string
	Name       string
	BanCount   int
	RangeCount int
	Percent    float64
}

CountryMetrics holds per-country ban statistics

type CountryStats added in v1.1.1

type CountryStats struct {
	CountryCode string
	Country     string
	Count       int
	Percent     float64
}

CountryStats for geo distribution

type CountryTraffic added in v1.6.1

type CountryTraffic struct {
	Code    string
	Name    string
	Packets int64
	Bytes   int64
	Blocked int64
}

CountryTraffic holds traffic by country

type DDoSMetrics added in v1.6.1

type DDoSMetrics struct {
	Enabled           bool
	TotalBlocks       int
	BlocksToday       int
	ActiveMitigations int
}

DDoSMetrics holds DDoS protection metrics

type DashboardData added in v1.1.1

type DashboardData struct {
	// System Identity (Top Left)
	Identity SystemIdentity

	// Security KPIs (Top Right)
	Security SecurityKPIs

	// Hardware Resources
	Resources ResourceStats

	// Module Status Grid
	Modules []ModuleStatus

	// Recent Activity
	RecentBans []RecentBan

	// Theme preference
	Theme string // "dark" or "light"
}

DashboardData contains all dashboard information for zero-refresh updates

type DiskInfo added in v1.6.1

type DiskInfo struct {
	Path        string
	TotalGB     float64
	UsedGB      float64
	FreeGB      float64
	Percent     float64
	FSType      string
	InodesUsed  int64
	InodesTotal int64
}

DiskInfo holds disk information

type FHSItem added in v1.1.1

type FHSItem struct {
	Path     string
	Expected string
	Actual   string
	Status   string // "ok", "error", "warning"
	Notes    string
}

FHSItem represents a filesystem hierarchy item

type FeedChartEntry added in v1.6.1

type FeedChartEntry struct {
	Name    string
	IPCount int
	Percent float64
}

FeedChartEntry represents a feed for chart display

type FeedEntry added in v1.6.1

type FeedEntry struct {
	Name        string
	Description string
	URL         string
	Status      string // "active", "syncing", "stale", "error", "disabled"
	Enabled     bool
	IPCount     int
	LastSync    string
	NextSync    string
	SyncErrors  int
	LastError   string
}

FeedEntry represents a single threat feed

type FeedMetrics added in v1.6.1

type FeedMetrics struct {
	Name       string
	Status     string // "active", "syncing", "stale", "error"
	IPCount    int
	LastSync   string
	NextSync   string
	SyncErrors int
}

FeedMetrics holds threat feed metrics

type FeedSyncActivity added in v1.6.1

type FeedSyncActivity struct {
	FeedName   string
	Status     string // "success", "error", "syncing"
	IPsAdded   int
	IPsRemoved int
	Timestamp  string
	Error      string
}

FeedSyncActivity represents a recent sync event

type FeedsPageData added in v1.6.1

type FeedsPageData struct {
	// Summary stats
	TotalFeeds  int
	ActiveFeeds int
	StaleFeeds  int
	ErrorFeeds  int
	TotalIPs    int
	LastCheck   string

	// Feed list
	Feeds []FeedEntry

	// Top feeds by IP count (for chart)
	TopFeeds []FeedChartEntry

	// Recent sync activity
	RecentActivity []FeedSyncActivity
}

FeedsPageData holds feeds page information

type FirewallMetrics added in v1.6.1

type FirewallMetrics struct {
	TableExists    bool
	RulesTotal     int
	SetsTotal      int
	CountersTotal  int
	ChainCount     int
	NftablesActive bool
}

FirewallMetrics holds nftables/firewall specific metrics

type GeoBlockEntry added in v1.6.1

type GeoBlockEntry struct {
	IP          string
	Country     string
	CountryCode string
	Timestamp   string
	Reason      string
}

GeoBlockEntry represents a recent geo-block event

type GeoCountryEntry added in v1.6.1

type GeoCountryEntry struct {
	Code         string
	Name         string
	Blocked      bool
	RangeCount   int
	IPCount      int64
	BansFromHere int
	LastBan      string
}

GeoCountryEntry represents a country in the GeoIP list

type GeoIPMetrics added in v1.6.1

type GeoIPMetrics struct {
	Enabled          bool
	DatabaseVersion  string
	DatabaseAge      string
	BlockedCountries int
	BlockedRanges    int
	CountryStats     []CountryMetrics
}

GeoIPMetrics holds GeoIP/GeoBan metrics

type GeoIPPageData added in v1.6.1

type GeoIPPageData struct {
	// Database info
	DatabasePath    string
	DatabaseVersion string
	DatabaseDate    string
	DatabaseSize    string
	LastUpdate      string
	NextUpdate      string
	UpdateEnabled   bool

	// Blocking config
	BlockingEnabled bool
	BlockingMode    string // "whitelist" or "blacklist"

	// Statistics
	TotalCountries   int
	BlockedCountries int
	AllowedCountries int
	TotalRanges      int
	TotalIPs         int64

	// Country list
	Countries []GeoCountryEntry

	// Recent blocks
	RecentBlocks []GeoBlockEntry
}

GeoIPPageData holds GeoIP page information

type GeoLookupResult added in v1.2.3

type GeoLookupResult struct {
	IP          string
	Country     string
	CountryCode string
	City        string
	Region      string
	ASN         string
	ASNOrg      string
	IsBlocked   bool   // Country is geo-blocked
	BlockReason string // Why blocked (if applicable)
}

GeoLookupResult holds GeoIP lookup results

type HealthCheck added in v1.1.1

type HealthCheck struct {
	Name     string
	Status   string // "ok", "warning", "error"
	ExitCode int
	Message  string
}

HealthCheck represents a single health check category

type HealthData added in v1.1.1

type HealthData struct {
	Timestamp     string
	OverallStatus string // "ok", "warning", "error"
	ExitCode      int
	ErrorCount    int
	WarningCount  int
	Checks        []HealthCheck
	Errors        []string
	Warnings      []string
}

HealthData holds comprehensive health check results

type HealthItem added in v1.1.1

type HealthItem struct {
	Name   string
	Status string // "ok", "warning", "error"
	Detail string // Additional info
}

HealthItem represents a single health check (legacy)

type IPCheckResult added in v1.1.1

type IPCheckResult struct {
	IP          string
	Status      string // "banned", "whitelisted", "clean"
	BannedSince string
	Reason      string
	Module      string
	Country     string
}

IPCheckResult holds the result of an IP lookup

type InterfaceMetrics added in v1.6.1

type InterfaceMetrics struct {
	Name    string
	RxMbps  float64
	TxMbps  float64
	RxBytes int64
	TxBytes int64
	Status  string // "up", "down"
}

InterfaceMetrics holds per-interface network stats

type InventoryData added in v1.1.1

type InventoryData struct {
	Services []ServiceInfo
	Timers   []TimerInfo
	Binaries []BinaryInfo
	Configs  []ConfigInfo
	FHS      []FHSItem
}

InventoryData holds all inventory information

type LogEntry added in v1.2.3

type LogEntry struct {
	Timestamp string
	Level     string // "INFO", "WARN", "ERROR", "BAN", "UNBAN"
	Module    string
	Message   string
	IP        string // Extracted IP if present
}

LogEntry represents a log line for the viewer

type MemoryInfo added in v1.6.1

type MemoryInfo struct {
	TotalGB     float64
	UsedGB      float64
	FreeGB      float64
	AvailableGB float64
	Percent     float64
	SwapTotalGB float64
	SwapUsedGB  float64
	SwapPercent float64
}

MemoryInfo holds memory information

type MetricsData added in v1.6.1

type MetricsData struct {
	// Collection info
	Timestamp      string
	CollectorState string // "running", "stopped", "stale"
	CachePath      string
	CacheAge       string

	// Summary cards
	Summary MetricsSummary

	// Detailed sections
	Firewall FirewallMetrics
	Security SecurityMetrics
	Network  NetworkMetrics
	System   SystemMetrics
	Modules  []ModuleMetrics
	Feeds    []FeedMetrics
	GeoIP    GeoIPMetrics
	Portscan PortscanMetrics
	DDoS     DDoSMetrics
	Suricata SuricataMetrics
}

MetricsData holds all metrics overview information

type MetricsSummary added in v1.6.1

type MetricsSummary struct {
	TotalBans        int
	BansIPv4         int
	BansIPv6         int
	TotalWhitelist   int
	ActiveFeeds      int
	BlockedCountries int
	EventsLastHour   int
	HealthStatus     string // "ok", "warning", "error"
}

MetricsSummary holds top-level summary metrics

type ModuleMetrics added in v1.6.1

type ModuleMetrics struct {
	Name        string
	Status      string // "active", "inactive", "error"
	Enabled     bool
	BansCount   int
	EventsCount int
	LastSync    string
	CPUPercent  float64
	MemoryMB    float64
}

ModuleMetrics holds per-module metrics

type ModuleStatus added in v1.1.1

type ModuleStatus struct {
	Name        string
	Description string
	Status      string // "active", "inactive", "failed", "warning"
	Enabled     bool
	Running     bool

	// Module-specific metrics
	BansProduced int     // How many IPs this module has added
	CPUPercent   float64 // Module-specific CPU (if separate process)
	MemoryMB     float64 // Module-specific memory
	LastSync     string  // Last time module reported in
	ServiceName  string  // Systemd service name for restart
}

ModuleStatus holds individual module information

type ModulesData added in v1.2.3

type ModulesData struct {
	Modules       []ModuleStatus
	TotalModules  int
	EnabledCount  int
	DisabledCount int
	RunningCount  int
}

ModulesData holds modules page information

type NavItem struct {
	Name   string
	Path   string
	Icon   string
	Active bool
}

NavItem represents a navigation menu item

type NetworkInterface added in v1.6.1

type NetworkInterface struct {
	Name       string
	Status     string // "up", "down"
	IPAddress  string
	MACAddress string
	MTU        int
	RxMbps     float64
	TxMbps     float64
	RxBytes    int64
	TxBytes    int64
	RxPackets  int64
	TxPackets  int64
	RxErrors   int64
	TxErrors   int64
	Dropped    int64
}

NetworkInterface holds interface information

type NetworkMetrics added in v1.6.1

type NetworkMetrics struct {
	RxMbps           float64
	TxMbps           float64
	TotalRxGB        float64
	TotalTxGB        float64
	PacketsDropped   int64
	ConnectionsTotal int
	ConnectionsNew   int
	TopInterface     string
	Interfaces       []InterfaceMetrics
}

NetworkMetrics holds network traffic metrics

type NetworkPageData added in v1.6.1

type NetworkPageData struct {
	// Summary
	TotalRxMbps    float64
	TotalTxMbps    float64
	TotalRxToday   string
	TotalTxToday   string
	ActiveConns    int
	DroppedPackets int64

	// Interfaces
	Interfaces []NetworkInterface

	// Connections
	TopConnections []ConnectionInfo

	// Traffic history (for graphs)
	TrafficHistory []TrafficSample

	// Dropped traffic
	DroppedByCountry []CountryTraffic
	DroppedByPort    []PortTraffic
}

NetworkPageData holds network page information

type PortMetrics added in v1.6.1

type PortMetrics struct {
	Port      int
	Protocol  string
	ScanCount int
}

PortMetrics holds per-port scan statistics

type PortTraffic added in v1.6.1

type PortTraffic struct {
	Port     int
	Protocol string
	Packets  int64
	Bytes    int64
	Blocked  int64
}

PortTraffic holds traffic by port

type PortscanMetrics added in v1.6.1

type PortscanMetrics struct {
	Enabled     bool
	TotalBlocks int
	BlocksToday int
	TopPorts    []PortMetrics
}

PortscanMetrics holds portscan detection metrics

type ProcessInfo added in v1.6.1

type ProcessInfo struct {
	PID        int
	Name       string
	User       string
	CPUPercent float64
	MemPercent float64
	MemMB      float64
	Status     string
}

ProcessInfo holds process information

type RecentBan added in v1.1.1

type RecentBan struct {
	IP          string
	Country     string
	CountryCode string
	Reason      string
	Module      string // Which module triggered the ban
	Timestamp   string
}

RecentBan represents a recent ban entry

type ResourceStats added in v1.1.1

type ResourceStats struct {
	// CPU
	CPUPercent   float64
	CPULoadAvg1  float64
	CPULoadAvg5  float64
	CPULoadAvg15 float64

	// RAM
	RAMUsedGB  float64
	RAMTotalGB float64
	RAMPercent float64

	// Disk (focus on log partition)
	DiskUsedGB  float64
	DiskTotalGB float64
	DiskPercent float64
	DiskPath    string // Which partition we're monitoring

	// NFTBan Process specifically
	NFTBanCPU    float64
	NFTBanMemMB  float64
	NFTBanUptime string
}

ResourceStats holds system resource information

type SearchMatch added in v1.2.3

type SearchMatch struct {
	SetName     string // "blacklist_ipv4", "whitelist_ipv4", "feed_spamhaus", etc.
	SetType     string // "blacklist", "whitelist", "feed", "geoban"
	EntryType   string // "exact", "cidr_match", "range"
	MatchedCIDR string // If CIDR match, show the network
	AddedAt     string
	Reason      string
}

SearchMatch represents where an IP was found

type SearchResult added in v1.2.3

type SearchResult struct {
	IP           string
	Found        bool
	FoundIn      []SearchMatch
	TotalMatches int
}

SearchResult holds cross-set search results

type SecurityKPIs added in v1.1.1

type SecurityKPIs struct {
	// Active Bans
	BansTotal int
	BansIPv4  int
	BansIPv6  int

	// Whitelist
	WhitelistTotal int
	WhitelistIPv4  int
	WhitelistIPv6  int

	// Network Stats
	NetworkInMbps  float64
	NetworkOutMbps float64
	PacketDropRate int // Packets rejected per second

	// Event counts
	EventsLastHour int
	TotalBansEver  int
}

SecurityKPIs holds security statistics

type SecurityMetrics added in v1.6.1

type SecurityMetrics struct {
	BansTotal      int
	BansTemporary  int
	BansPermanent  int
	BansFeed       int
	BansGeoIP      int
	UnbansToday    int
	WhitelistTotal int
	ThreatLevel    string // "low", "medium", "high", "critical"
}

SecurityMetrics holds security-related metrics

type ServiceInfo added in v1.1.1

type ServiceInfo struct {
	Name        string
	Description string
	Status      string // "active", "inactive", "failed"
	PID         int
	MemoryMB    float64
	Uptime      string
}

ServiceInfo represents a systemd service

type SuricataMetrics added in v1.6.1

type SuricataMetrics struct {
	Enabled     bool
	Status      string
	AlertsTotal int
	AlertsToday int
	RulesLoaded int
	TopAlerts   []AlertMetrics
}

SuricataMetrics holds Suricata IDS metrics

type SystemIdentity added in v1.1.1

type SystemIdentity struct {
	Hostname      string
	Kernel        string
	Uptime        string
	UptimeSeconds int64 // For JS counter
	NFTBanVersion string
	PanelMode     string // "active", "warning", "error"
	Heartbeat     bool   // Backend responding
}

SystemIdentity holds system identification info

type SystemMetrics added in v1.6.1

type SystemMetrics struct {
	Hostname      string
	Kernel        string
	Uptime        string
	UptimeSeconds int64
	CPUPercent    float64
	MemPercent    float64
	DiskPercent   float64
	LoadAvg1      float64
	LoadAvg5      float64
	LoadAvg15     float64
	NFTBanVersion string
	NFTBanPID     int
	NFTBanCPU     float64
	NFTBanMemMB   float64
}

SystemMetrics holds system resource metrics

type SystemPageData added in v1.6.1

type SystemPageData struct {
	// Identity
	Hostname      string
	OS            string
	Kernel        string
	Arch          string
	Uptime        string
	UptimeSeconds int64
	BootTime      string

	// NFTBan info
	NFTBanVersion string
	NFTBanBuild   string
	NFTBanCommit  string
	NFTBanUptime  string
	NFTBanPID     int
	NFTBanCPU     float64
	NFTBanMemMB   float64

	// Resources
	CPU    CPUInfo
	Memory MemoryInfo
	Disk   DiskInfo

	// Services
	Services []SystemService

	// Processes
	TopProcesses []ProcessInfo
}

SystemPageData holds system page information

type SystemService added in v1.6.1

type SystemService struct {
	Name        string
	Description string
	Status      string // "active", "inactive", "failed"
	PID         int
	MemoryMB    float64
	Uptime      string
	Restarts    int
}

SystemService represents a system service status

type TimerInfo added in v1.1.1

type TimerInfo struct {
	Name        string
	Description string
	Status      string // "active", "inactive", "enabled"
	NextRun     string
	LastRun     string
}

TimerInfo represents a systemd timer

type ToolsData added in v1.2.3

type ToolsData struct {
	// Last lookup results (if any)
	LastIPCheck   *IPCheckResult
	LastGeoLookup *GeoLookupResult
	LastSearch    *SearchResult

	// Log viewer
	RecentLogs []LogEntry

	// Quick stats for tools context
	TotalBans      int
	TotalWhitelist int
	TotalFeeds     int
}

ToolsData holds diagnostic tools data

type TrafficSample added in v1.6.1

type TrafficSample struct {
	Timestamp string
	RxMbps    float64
	TxMbps    float64
}

TrafficSample holds a traffic history point

type UserInfo

type UserInfo struct {
	Username string
	Role     string
}

UserInfo holds current user session info

type WhitelistData added in v1.2.3

type WhitelistData struct {
	// Summary stats
	TotalEntries int
	IPv4Count    int
	IPv6Count    int
	NetworkCount int // CIDR ranges

	// Whitelist entries
	Entries []WhitelistEntry

	// Sources breakdown
	Sources []WhitelistSource
}

WhitelistData holds all whitelist information

type WhitelistEntry added in v1.2.3

type WhitelistEntry struct {
	IP      string
	Type    string // "ip", "network", "range"
	Comment string
	Source  string // Config file name
	AddedAt string
	AddedBy string // "manual", "system", "api"
}

WhitelistEntry represents a single whitelisted IP/network

type WhitelistSource added in v1.2.3

type WhitelistSource struct {
	Name       string
	Path       string
	EntryCount int
	Editable   bool // System files not editable
}

WhitelistSource represents a whitelist source file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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