Documentation
¶
Overview ¶
Package rules implements Warden's rule engine: an in-memory, disk-backed store of firewall rules keyed by process identity, with the lookup that the network extension consults for every new flow. Mirrors Warden's Extension/Rules.
Index ¶
- type Engine
- func (e *Engine) Add(r *shared.Rule)
- func (e *Engine) All() []*shared.Rule
- func (e *Engine) Delete(key, uuid string) bool
- func (e *Engine) Find(key, remoteAddr, remotePort string) shared.RuleState
- func (e *Engine) Load() error
- func (e *Engine) MarshalJSON() ([]byte, error)
- func (e *Engine) Save() error
- func (e *Engine) Toggle(key, uuid string, disabled bool) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is a concurrency-safe rule store keyed by process identity (signing id or path). The network extension reads it on the flow path; the XPC daemon mutates it in response to app requests and user alert decisions.
func (*Engine) Delete ¶
Delete removes the rule with uuid under key, returning whether it was found.
func (*Engine) Find ¶
Find returns the verdict for a flow from process key to remoteAddr:remotePort: RuleStateAllow, RuleStateBlock, or RuleStateNotFound when no rule matches (the caller then prompts the user). Endpoint-specific rules win over process-wide ones because they are matched first.
func (*Engine) MarshalJSON ¶
MarshalJSON serializes the whole store (used by the daemon's getRules reply).