matchrule

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cond

type Cond byte
const (
	CondAnd Cond = iota
	CondOr
)

func (*Cond) UnmarshalJSON

func (c *Cond) UnmarshalJSON(i []byte) error

type Mode

type Mode byte
const (
	ModePrefix Mode = iota
	ModeContains
	ModeSuffix
)

func (*Mode) UnmarshalJSON

func (m *Mode) UnmarshalJSON(i []byte) error

type Rule

type Rule struct {
	// > @3@4@5@6
	// >
	// > Values to match at least one value.
	Values []string `json:"values" default:"" slice:"true"` // *

	// > @3@4@5@6
	// >
	// > Matching mode. Allowed modes: `prefix`, `contains`, `suffix`. Defaults to `contains`.
	Mode Mode `json:"mode"` // *

	// > @3@4@5@6
	// >
	// > CaseInsensitive is the truth then Match results in a lowercase search value.
	// > Not available fo the ModeContains because performance issues may arise.
	CaseInsensitive bool `json:"case_insensitive"` // *

	// > @3@4@5@6
	// >
	// > Flag indicating whether to negate the result of matching rule.
	Invert bool `json:"invert"` // *
	// contains filtered or unexported fields
}

func (*Rule) Match

func (r *Rule) Match(raw []byte) bool

func (*Rule) Prepare added in v0.14.0

func (r *Rule) Prepare()

type RuleSet

type RuleSet struct {
	// > @3@4@5@6
	// >
	// > Name of the ruleset.
	Name string `json:"name"` // *

	// > @3@4@5@6
	// >
	// > Condition for combining rules. Allowed values: `and`, `or`. Defaults to `and`.
	Cond Cond `json:"cond" default:"and" options:"and|or"` // *

	// > @3@4@5@6
	// >
	// > List of rules to check.
	Rules []Rule `json:"rules" default:"" slice:"true"` // *
}

func (*RuleSet) Match

func (rs *RuleSet) Match(data []byte) bool

func (*RuleSet) Prepare added in v0.14.0

func (rs *RuleSet) Prepare()

type RuleSets added in v0.14.0

type RuleSets []RuleSet

func (RuleSets) Prepare added in v0.14.0

func (rs RuleSets) Prepare()

Jump to

Keyboard shortcuts

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