Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ReportsDir string // Output directory for reports
HistoryDir string // Input: stats history directory
BansLogPath string // Input: bans.log path
RetentionDays int // Days to keep reports
TopN int // Number of items in top lists (default 10)
}
Config holds report generator configuration
type DailySummary ¶
type DailySummary struct {
Date string `json:"date"` // YYYY-MM-DD
Host string `json:"host"`
GeneratedAt time.Time `json:"generated_at"`
Totals struct {
BansAdded int `json:"bans_added"`
BansRemoved int `json:"bans_removed"`
BansActiveEnd int `json:"bans_active_end"`
WhitelistCount int `json:"whitelist_count"`
} `json:"totals"`
BansBySource map[string]int `json:"bans_by_source"` // loginmon, portscan, ddos, suricata, feeds, manual
BansByCountry map[string]int `json:"bans_by_country"` // RU, CN, US, etc.
Feeds map[string]FeedState `json:"feeds"`
Watchdog struct {
PressureMax map[string]float64 `json:"pressure_max"` // cpu, memory, io
ModeChanges int `json:"mode_changes"`
} `json:"watchdog"`
Health struct {
UptimePercent float64 `json:"uptime_percent"`
ErrorsCount int `json:"errors_count"`
} `json:"health"`
}
DailySummary contains aggregated metrics for one day
type DailyTop ¶
type DailyTop struct {
Date string `json:"date"` // YYYY-MM-DD
TopBannedIPs []TopIP `json:"top_banned_ips"`
TopCountries []TopCountry `json:"top_countries"`
TopSources []TopSource `json:"top_sources"`
RecidivistIPs []RecidivistIP `json:"recidivist_ips"`
}
DailyTop contains top lists for one day
type FeedState ¶
type FeedState struct {
IPsLoaded int `json:"ips_loaded"`
LastSync int64 `json:"last_sync"` // Unix timestamp
}
FeedState represents feed status at time of report
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator creates daily reports
func NewGenerator ¶
NewGenerator creates a new report generator
func (*Generator) GenerateDaily ¶
GenerateDaily generates summary and top reports for a specific date
type IndexEntry ¶
type IndexEntry struct {
Date string `json:"date"`
Bans int `json:"bans"`
Unbans int `json:"unbans"`
Active int `json:"active"`
TopCountry string `json:"top_country"`
TopSource string `json:"top_source"`
}
IndexEntry is one line in reports/index.jsonl for fast search
type RecidivistIP ¶
type RecidivistIP struct {
IP string `json:"ip"`
BanCount int `json:"ban_count"`
FirstSeen string `json:"first_seen"` // YYYY-MM-DD
LastSeen string `json:"last_seen"` // YYYY-MM-DD
}
RecidivistIP represents an IP banned multiple times
type TopCountry ¶
type TopCountry struct {
Country string `json:"country"`
Bans int `json:"bans"`
Percentage float64 `json:"percentage"`
}
TopCountry represents country ban statistics
Click to show internal directories.
Click to hide internal directories.