You've already forked caddy-opnsense-blocker
Add background IP intel and restore dashboard stats
This commit is contained in:
@@ -139,4 +139,18 @@ func TestStoreRecordsEventsAndState(t *testing.T) {
|
||||
if !found || loadedInvestigation.Bot == nil || loadedInvestigation.Bot.Name != "Googlebot" {
|
||||
t.Fatalf("unexpected investigation payload: found=%v investigation=%+v", found, loadedInvestigation)
|
||||
}
|
||||
investigations, err := db.GetInvestigationsForIPs(ctx, []string{event.ClientIP, "198.51.100.99"})
|
||||
if err != nil {
|
||||
t.Fatalf("get investigations for ips: %v", err)
|
||||
}
|
||||
if len(investigations) != 1 || investigations[event.ClientIP].Bot == nil {
|
||||
t.Fatalf("unexpected investigations map: %+v", investigations)
|
||||
}
|
||||
userAgents, err := db.ListRecentUserAgentsForIP(ctx, event.ClientIP, 10)
|
||||
if err != nil {
|
||||
t.Fatalf("list recent user agents: %v", err)
|
||||
}
|
||||
if len(userAgents) != 1 || userAgents[0] != event.UserAgent {
|
||||
t.Fatalf("unexpected user agents: %#v", userAgents)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user