MCPcopy
hub / github.com/evilsocket/opensnitch / NewLoader

Function NewLoader

daemon/rule/loader.go:40–53  ·  view source on GitHub ↗

NewLoader loads rules from disk, and watches for changes made to the rules files on disk.

(liveReload bool)

Source from the content-addressed store, hash-verified

38// NewLoader loads rules from disk, and watches for changes made to the rules files
39// on disk.
40func NewLoader(liveReload bool) (*Loader, error) {
41 watcher, err := fsnotify.NewWatcher()
42 if err != nil {
43 return nil, err
44 }
45 return &Loader{
46 Path: "",
47 rules: make(map[string]*Rule),
48 liveReload: liveReload,
49 watcher: watcher,
50 liveReloadRunning: false,
51 stopLiveReload: make(chan struct{}),
52 }, nil
53}
54
55// NumRules returns he number of loaded rules.
56func (l *Loader) NumRules() int {

Callers 4

TestRuleLoaderFunction · 0.85
TestRuleLoaderListFunction · 0.85
TestLiveReloadFunction · 0.85

Calls

no outgoing calls

Tested by 4

TestRuleLoaderFunction · 0.68
TestRuleLoaderListFunction · 0.68
TestLiveReloadFunction · 0.68