Documentation
¶
Overview ¶
Package watch turns dsecrat's one-shot analysis into continuous monitoring. It re-runs the engine against a target on an interval, diffs each run against the previous one, and emits only the *delta* — findings that newly appeared or cleared — through the normal connectors. This is what makes the spec's "continuous re-scan / drift / clean-yesterday-vulnerable-today" controls real without adding any new detection logic: the modules are unchanged, only the scheduling and diffing are new.
The core is split so it stays testable with zero wall-clock dependence:
- Diff is a pure function over two reports.
- Run performs a single scan+diff+dispatch cycle.
- Loop drives Run on a caller-supplied tick channel and stops on context cancellation, so a test can feed synthetic ticks and assert deterministic behavior; the CLI supplies a real time.Ticker.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Delta ¶
Delta is the difference between two consecutive scans: findings that appeared this run (New) and findings present last run but gone now (Cleared).
type EngineScanner ¶
EngineScanner adapts an engine + target into a Scanner, running the named modules (empty = all).
type Observer ¶
Observer is notified after every cycle, whether or not the delta changed. The CLI uses it to print a heartbeat line; tests use it to record cycles.
type ObserverFunc ¶
ObserverFunc adapts a function to Observer.
type Scanner ¶
Scanner produces a report for the watched target. It abstracts the engine so tests can inject a deterministic sequence of reports.
type Watcher ¶
type Watcher struct {
Scanner Scanner
Connectors []connector.Connector
Observer Observer
// OnlyDeltas, when true (the default behavior chosen by the CLI), dispatches
// to connectors only when the delta is non-empty, so a stable target stays
// quiet. When false, every cycle's full report is dispatched.
OnlyDeltas bool
// contains filtered or unexported fields
}
Watcher runs continuous monitoring over one target.