provider

package
v1.19.3 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: GPL-3.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPayload     = errors.New("file must have a `payload` field")
	ErrInvalidFormat = errors.New("invalid format")
)
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 NewInlineProvider added in v1.19.1

func NewInlineProvider(name string, behavior P.RuleBehavior, payload []string, parse common.ParseRuleFunc) P.RuleProvider

func NewRuleSetProvider

func NewRuleSetProvider(name string, behavior P.RuleBehavior, format P.RuleFormat, interval time.Duration, vehicle P.Vehicle, parse common.ParseRuleFunc) P.RuleProvider

func ParseRuleProvider

func ParseRuleProvider(name string, mapping map[string]any, parse common.ParseRuleFunc) (P.RuleProvider, error)

func SetTunnel added in v1.18.6

func SetTunnel(t P.Tunnel)

Types

type InlineProvider added in v1.19.1

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

func (InlineProvider) Initial added in v1.19.1

func (i InlineProvider) Initial() error

func (InlineProvider) MarshalJSON added in v1.19.1

func (i InlineProvider) MarshalJSON() ([]byte, error)

func (InlineProvider) Name added in v1.19.1

func (i InlineProvider) Name() string

func (InlineProvider) Update added in v1.19.1

func (i InlineProvider) Update() error

func (InlineProvider) VehicleType added in v1.19.1

func (i InlineProvider) VehicleType() P.VehicleType

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) Close added in v1.18.8

func (rp *RuleSetProvider) Close() error

func (RuleSetProvider) Initial

func (rp RuleSetProvider) Initial() error

func (RuleSetProvider) MarshalJSON

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

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