Documentation
¶
Index ¶
- type Event
- type EventType
- type Handler
- type UnauthorizedChangeReporter
- type Watcher
- func (w *Watcher) AddHandler(handler Handler)
- func (w *Watcher) ExportChecksums() (string, error)
- func (w *Watcher) ForceChecksum(path string, checksum string)
- func (w *Watcher) GetCurrentChecksums() map[string]string
- func (w *Watcher) IgnorePath(path string)
- func (w *Watcher) ImportChecksums(jsonData string) error
- func (w *Watcher) IsRunning() bool
- func (w *Watcher) Scan() ([]Event, error)
- func (w *Watcher) Start() error
- func (w *Watcher) Stop() error
- func (w *Watcher) UnignorePath(path string)
- func (w *Watcher) Verify() (map[string]bool, error)
- type WatcherOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Type EventType `json:"type"`
Path string `json:"path"`
OldPath string `json:"old_path,omitempty"`
Timestamp time.Time `json:"timestamp"`
Checksum string `json:"checksum,omitempty"`
OldChecksum string `json:"old_checksum,omitempty"`
Size int64 `json:"size,omitempty"`
Error string `json:"error,omitempty"`
}
Event represents a file change event
type UnauthorizedChangeReporter ¶
type UnauthorizedChangeReporter struct {
}
UnauthorizedChangeReporter reports unauthorized changes
func NewUnauthorizedChangeReporter ¶
func NewUnauthorizedChangeReporter(events []Event, severity string) *UnauthorizedChangeReporter
NewUnauthorizedChangeReporter creates a reporter for unauthorized changes
func (*UnauthorizedChangeReporter) Summary ¶
func (r *UnauthorizedChangeReporter) Summary() string
Summary returns a summary of the changes
func (*UnauthorizedChangeReporter) ToJSON ¶
func (r *UnauthorizedChangeReporter) ToJSON() (string, error)
ToJSON converts the report to JSON
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher monitors file changes for unauthorized modifications
func NewWatcher ¶
func NewWatcher(opts *WatcherOptions) (*Watcher, error)
NewWatcher creates a new file watcher
func (*Watcher) AddHandler ¶
AddHandler adds an event handler
func (*Watcher) ExportChecksums ¶
ExportChecksums exports checksums to JSON
func (*Watcher) ForceChecksum ¶
ForceChecksum forces a checksum for a path
func (*Watcher) GetCurrentChecksums ¶
GetCurrentChecksums returns a copy of current checksums
func (*Watcher) IgnorePath ¶
IgnorePath adds a path to ignore
func (*Watcher) ImportChecksums ¶
ImportChecksums imports checksums from JSON
func (*Watcher) UnignorePath ¶
UnignorePath removes a path from ignore list
type WatcherOptions ¶
WatcherOptions for configuring the watcher
func DefaultWatcherOptions ¶
func DefaultWatcherOptions() *WatcherOptions
DefaultWatcherOptions returns default watcher options