Reload guard.yaml without losing the bounties

systemctl reload guard, guard reload or SIGHUP reads the configuration
again: a watch keeps its bounties and counts under the same name and
takes its new settings at once; its source starts again only if it
changed; watches gone stop, new ones start; a file with a mistake is
refused. The Housecarl connection, state, socket and log wait for a
restart, and guard reload says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
abrown38andClaude Opus 5.5 committed 2026-10-25 01:32:20 +00:00
1 parent 9c655abae2
commit ecf4129877
11 files changed
+607 -93

No files matched your search

+7
View File
@@ -46,6 +46,13 @@ func (t *Tracker) Add(p netip.Prefix, at time.Time) (int, bool) {
return len(ts), false
}
// Set changes the hits and window (a reload); the bounties stay.
func (t *Tracker) Set(hits int, within time.Duration) {
t.mu.Lock()
t.Hits, t.Within = hits, within
t.mu.Unlock()
}
// keep drops the times before from (times are in order).
func keep(ts []time.Time, from time.Time) []time.Time {
i := 0