provider

package
v1.18.9 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: GPL-3.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidFormat = errors.New("invalid format")
View Source
var ErrNoPayload = errors.New("file must have a `payload` field")
View Source
var MrsMagicBytes = [4]byte{'M', 'R', 'S', 1} // MRSv1

Functions

func ConvertMain added in v1.18.7

func ConvertMain(args []string)

func ConvertToMrs added in v1.18.7

func ConvertToMrs(buf []byte, behavior P.RuleBehavior, format P.RuleFormat, w io.Writer) (err error)

func NewClassicalStrategy

func NewClassicalStrategy(parse func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)) *classicalStrategy

func NewDomainStrategy

func NewDomainStrategy() *domainStrategy

func NewIPCidrStrategy

func NewIPCidrStrategy() *ipcidrStrategy

func NewRuleSetProvider

func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleFormat, interval time.Duration, vehicle P.Vehicle,
	parse func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)) P.RuleProvider

func ParseRuleProvider

func ParseRuleProvider(name string, mapping map[string]interface{}, parse func(tp, payload, target string, params []string, subRules map[string][]C.Rule) (parsed C.Rule, parseErr error)) (P.RuleProvider, error)

func SetTunnel added in v1.18.6

func SetTunnel(t P.Tunnel)

Types

type RulePayload

type RulePayload struct {
	/**
	key: Domain or IP Cidr
	value: Rule type or is empty
	*/
	Payload []string `yaml:"payload"`
	Rules   []string `yaml:"rules"`
}

type RuleSet

type RuleSet struct {
	*common.Base
	// contains filtered or unexported fields
}

func NewRuleSet

func NewRuleSet(ruleProviderName string, adapter string, isSrc bool, noResolveIP bool) (*RuleSet, error)

func (*RuleSet) Adapter

func (rs *RuleSet) Adapter() string

func (*RuleSet) Match

func (rs *RuleSet) Match(metadata *C.Metadata) (bool, string)

func (*RuleSet) MatchDomain added in v1.18.8

func (rs *RuleSet) MatchDomain(domain string) bool

MatchDomain implements C.DomainMatcher

func (*RuleSet) MatchIp added in v1.18.8

func (rs *RuleSet) MatchIp(ip netip.Addr) bool

MatchIp implements C.IpMatcher

func (*RuleSet) Payload

func (rs *RuleSet) Payload() string

func (*RuleSet) ProviderNames added in v1.18.6

func (rs *RuleSet) ProviderNames() []string

func (*RuleSet) RuleType

func (rs *RuleSet) RuleType() C.RuleType

func (*RuleSet) ShouldFindProcess

func (rs *RuleSet) ShouldFindProcess() bool

func (*RuleSet) ShouldResolveIP

func (rs *RuleSet) ShouldResolveIP() bool

type RuleSetProvider

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

func (RuleSetProvider) Behavior

func (rp RuleSetProvider) Behavior() P.RuleBehavior

func (*RuleSetProvider) Close added in v1.18.8

func (rp *RuleSetProvider) Close() error

func (RuleSetProvider) Count added in v1.18.8

func (rp RuleSetProvider) Count() int

func (RuleSetProvider) Initial

func (rp RuleSetProvider) Initial() error

func (RuleSetProvider) MarshalJSON

func (rp RuleSetProvider) MarshalJSON() ([]byte, error)

func (RuleSetProvider) Match

func (rp RuleSetProvider) Match(metadata *C.Metadata) bool

func (RuleSetProvider) ShouldFindProcess

func (rp RuleSetProvider) ShouldFindProcess() bool

func (RuleSetProvider) ShouldResolveIP

func (rp RuleSetProvider) ShouldResolveIP() bool

func (RuleSetProvider) Strategy added in v1.18.6

func (rp RuleSetProvider) Strategy() any

func (RuleSetProvider) Type

func (rp RuleSetProvider) Type() P.ProviderType

func (RuleSetProvider) Update

func (rp RuleSetProvider) Update() error

Jump to

Keyboard shortcuts

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