ruleEngine

package
v0.14.8 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRuleIds

func GetRuleIds() ([]string, error)

Types

type Domain

type Domain struct {
	RuleType constants.RuleConfig `json:"ruleType"`
	Payload  string               `json:"payload"`
	Policy   string               `json:"policy"`
}

func NewDomainRule

func NewDomainRule(payload, policy string) (*Domain, error)

func (Domain) GetPolicy added in v0.13.0

func (d Domain) GetPolicy() constants.RuleType

func (Domain) Match

func (d Domain) Match(value string) bool

func (Domain) Type

func (d Domain) Type() constants.RuleConfig

func (Domain) Value

func (d Domain) Value() string

type Engine

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

func New

func New(name string, extraRules []string) (*Engine, error)

func (*Engine) Match

func (e *Engine) Match(value string) (Rule, error)

type IpCidr

type IpCidr struct {
	RuleType constants.RuleConfig `json:"ruleType"`
	Payload  string               `json:"payload"`

	Policy string `json:"policy"`
	// contains filtered or unexported fields
}

func NewIpCidrRule

func NewIpCidrRule(payload string, policy string) (*IpCidr, error)

func (IpCidr) GetPolicy added in v0.13.0

func (d IpCidr) GetPolicy() constants.RuleType

func (IpCidr) Match

func (i IpCidr) Match(value string) bool

func (IpCidr) Type

func (i IpCidr) Type() constants.RuleConfig

func (IpCidr) Value

func (i IpCidr) Value() string

type Rule

type Rule interface {
	Match(value string) bool
	Value() string
	GetPolicy() constants.RuleType
	Type() constants.RuleConfig
}

func Parse

func Parse(name string, extraRules []string) ([]Rule, error)

func ParseItem

func ParseItem(rawRuleType, value, policy string) (Rule, error)

func ParseRawValue added in v0.12.0

func ParseRawValue(line string) (Rule, error)

Jump to

Keyboard shortcuts

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