policy

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PolicyEngine

type PolicyEngine struct {
	// contains filtered or unexported fields
}

func NewPolicyEngine

func NewPolicyEngine() *PolicyEngine

func (*PolicyEngine) Diff

func (e *PolicyEngine) Diff(newRules []PolicyRule) (added, removed, changed []PolicyRule)

func (*PolicyEngine) GetMode

func (e *PolicyEngine) GetMode() PolicyMode

func (*PolicyEngine) GetPolicy

func (e *PolicyEngine) GetPolicy() *SecurityPolicy

func (*PolicyEngine) LoadPolicy

func (e *PolicyEngine) LoadPolicy(rules []PolicyRule) *SecurityPolicy

func (*PolicyEngine) OnChange

func (e *PolicyEngine) OnChange(fn func(*SecurityPolicy))

func (*PolicyEngine) SetMode

func (e *PolicyEngine) SetMode(mode PolicyMode)

func (*PolicyEngine) Validate

func (e *PolicyEngine) Validate() []string

type PolicyMode

type PolicyMode string
const (
	ModeEnforce PolicyMode = "enforce"
	ModeShadow  PolicyMode = "shadow"
	ModeCanary  PolicyMode = "canary"
)

type PolicyRule

type PolicyRule struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Action  string `json:"action"`
	Pattern string `json:"pattern"`
	Enabled bool   `json:"enabled"`
}

type SecurityPolicy

type SecurityPolicy struct {
	Version   string       `json:"version"`
	SHA256    string       `json:"sha256"`
	Mode      PolicyMode   `json:"mode"`
	Rules     []PolicyRule `json:"rules"`
	UpdatedAt time.Time    `json:"updated_at"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL