Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBannedTotal ¶
func GetBannedTotal() int64
GetBannedTotal returns total banned IPs (IPv4 + IPv6).
func GetWhitelistTotal ¶
func GetWhitelistTotal() int64
GetWhitelistTotal returns total whitelist IPs (IPv4 + IPv6).
func IsInitialized ¶
func IsInitialized() bool
IsInitialized returns true if snapshot has been populated at least once.
func Update ¶
func Update(snap BasicSnapshot)
Update is called by watchdog after each collection cycle. This populates the shared state that all BASIC tier consumers read from.
func UpdateFeeds ¶
UpdateFeeds updates just the feeds-related fields in the snapshot. Called by feeds loader/sync after feed operations complete. This allows feeds data to be updated independently of watchdog nftables collection.
Types ¶
type BasicSnapshot ¶
type BasicSnapshot struct {
// nftables data (from watchdog netlink - NO CLI)
BannedIPv4 int64 `json:"banned_ipv4"`
BannedIPv6 int64 `json:"banned_ipv6"`
WhitelistIPv4 int64 `json:"whitelist_ipv4"`
WhitelistIPv6 int64 `json:"whitelist_ipv6"`
RulesTotal int64 `json:"rules_total"`
// Feeds data (from loader in-memory - NO CLI)
FeedsActive int `json:"feeds_active"`
FeedsIPs int64 `json:"feeds_ips"`
// Timestamp
UpdatedAt time.Time `json:"updated_at"`
}
BasicSnapshot holds data needed by BASIC tier consumers. This is the single source of truth for:
- nftban stats command
- nftban status command
- Web UI dashboard
- Sampler (when metrics disabled)
Data is populated by watchdog (netlink) and feeds loader (in-memory). NO CLI CALLS - all consumers read from this shared state.
func Get ¶
func Get() BasicSnapshot
Get returns current snapshot for BASIC tier consumers (sampler, stats CLI, status CLI, UI handlers).