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

Method Add

daemon/rule/loader.go:159–166  ·  view source on GitHub ↗

Add adds a rule to the list of rules, and optionally saves it to disk.

(rule *Rule, saveToDisk bool)

Source from the content-addressed store, hash-verified

157
158// Add adds a rule to the list of rules, and optionally saves it to disk.
159func (l *Loader) Add(rule *Rule, saveToDisk bool) error {
160 l.addUserRule(rule)
161 if saveToDisk {
162 fileName := filepath.Join(l.Path, fmt.Sprintf("%s.json", rule.Name))
163 return l.Save(rule, fileName)
164 }
165 return nil
166}
167
168// Replace adds a rule to the list of rules, and optionally saves it to disk.
169func (l *Loader) Replace(rule *Rule, saveToDisk bool) error {

Callers 14

TestRuleLoaderFunction · 0.95
acceptOrDenyFunction · 0.45
liveReloadWorkerMethod · 0.45
writerWorkerFunction · 0.45
SetupDailyTimersMethod · 0.45
StartMethod · 0.45
dumpSocketsMethod · 0.45
dumpXDPSocketsFunction · 0.45
dumpPacketSocketsFunction · 0.45
runToolMethod · 0.45
AddWatchMethod · 0.45
AddWatchesMethod · 0.45

Calls 2

addUserRuleMethod · 0.95
SaveMethod · 0.95

Tested by 1

TestRuleLoaderFunction · 0.76