2

Refine requests log filter controls

This commit is contained in:
2026-03-12 18:52:21 +01:00
parent fef2237c49
commit 6b9330529c
3 changed files with 80 additions and 16 deletions

View File

@@ -9,6 +9,7 @@ import (
"log"
"net"
"os"
"sort"
"strings"
"sync"
"syscall"
@@ -113,6 +114,27 @@ func (s *Service) ListEvents(ctx context.Context, since time.Time, limit int, op
return items, nil
}
func (s *Service) ListSourceNames() []string {
if s == nil || s.cfg == nil || len(s.cfg.Sources) == 0 {
return nil
}
seen := make(map[string]struct{}, len(s.cfg.Sources))
items := make([]string, 0, len(s.cfg.Sources))
for _, source := range s.cfg.Sources {
name := strings.TrimSpace(source.Name)
if name == "" {
continue
}
if _, ok := seen[name]; ok {
continue
}
seen[name] = struct{}{}
items = append(items, name)
}
sort.Strings(items)
return items
}
func (s *Service) ListIPs(ctx context.Context, limit int, state string) ([]model.IPState, error) {
return s.store.ListIPStates(ctx, limit, state)
}