You've already forked caddy-opnsense-blocker
Simplify the dashboard recent IP view
This commit is contained in:
@@ -106,6 +106,16 @@ func TestStoreRecordsEventsAndState(t *testing.T) {
|
||||
if overview.TotalEvents != 1 || overview.TotalIPs != 1 {
|
||||
t.Fatalf("unexpected overview counters: %+v", overview)
|
||||
}
|
||||
recentIPs, err := db.ListRecentIPRows(ctx, occurredAt.Add(-time.Hour), 10)
|
||||
if err != nil {
|
||||
t.Fatalf("list recent ip rows: %v", err)
|
||||
}
|
||||
if len(recentIPs) != 1 {
|
||||
t.Fatalf("unexpected recent ip rows count: %d", len(recentIPs))
|
||||
}
|
||||
if recentIPs[0].IP != event.ClientIP || recentIPs[0].SourceName != event.SourceName || recentIPs[0].Events != 1 {
|
||||
t.Fatalf("unexpected recent ip row: %+v", recentIPs[0])
|
||||
}
|
||||
details, err := db.GetIPDetails(ctx, event.ClientIP, 10, 10, 10)
|
||||
if err != nil {
|
||||
t.Fatalf("get ip details: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user