You've already forked caddy-opnsense-blocker
Refine requests log filter controls
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user