rule

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRawRules

func DefaultRawRules() []byte

func LoadDefaultRules

func LoadDefaultRules() error

func LoadRules

func LoadRules(rulesJSON []byte) error

func RestRules

func RestRules()

Types

type Condition

type Condition struct {
	Inspector     string          `json:"inspector"`
	InspectTarget []InspectTarget `json:"inspect_target"`

	Regex     string   `json:"regex,omitempty"`
	MatchList []string `json:"match_list,omitempty"`

	Threshold float64 `json:"threshold,omitempty"`
}

type InspectTarget

type InspectTarget struct {
	Target string   `json:"target"`
	Keys   []string `json:"keys"`
}

type Rule

type Rule struct {
	ID         string      `json:"id"`
	Name       string      `json:"name"`
	Tags       []string    `json:"tags"`
	Action     string      `json:"action"`
	Conditions []Condition `json:"conditions"`
}

func (Rule) IsBlockAction

func (r Rule) IsBlockAction() bool

type RuleSet

type RuleSet struct {
	Version string
	Rules   []Rule
}
var LoadedRule *RuleSet

func (RuleSet) Validate

func (r RuleSet) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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