provider

package
v0.0.0-...-17b02d1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

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

func ConvertMain(args []string)

func ConvertToMrs

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

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

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

MatchDomain implements C.DomainMatcher

func (*RuleSet) MatchIp

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

MatchIp implements C.IpMatcher

func (*RuleSet) Payload

func (rs *RuleSet) Payload() string

func (*RuleSet) ProviderNames

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

func (rp *RuleSetProvider) Close() error

func (RuleSetProvider) Count

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

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