routing

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyRulesOptimizers

func ApplyRulesOptimizers(rules []*config_parser.RoutingRule, optimizers ...RulesOptimizer) ([]*config_parser.RoutingRule, error)

func DeepCloneRules

func DeepCloneRules(rules []*config_parser.RoutingRule) (newRules []*config_parser.RoutingRule)

Types

type AliasOptimizer

type AliasOptimizer struct {
}

func (*AliasOptimizer) Optimize

type DatReaderOptimizer

type DatReaderOptimizer struct {
	LocationFinder *assets.LocationFinder
	Logger         *logrus.Logger
}

func (*DatReaderOptimizer) Optimize

type DeduplicateParamsOptimizer

type DeduplicateParamsOptimizer struct {
}

func (*DeduplicateParamsOptimizer) Optimize

type DomainMatcher

type DomainMatcher interface {
	AddSet(bitIndex int, patterns []string, typ consts.RoutingDomainKey)
	Build() error
	MatchDomainBitmap(domain string) (bitmap []uint32)
}

type DomainSet

type DomainSet struct {
	Key       consts.RoutingDomainKey
	RuleIndex int
	Domains   []string
}

type FunctionParser

type FunctionParser func(log *logrus.Logger, f *config_parser.Function, key string, paramValueGroup []string, overrideOutbound *Outbound) (err error)

func EmptyKeyPlainParserFactory

func EmptyKeyPlainParserFactory(callback func(f *config_parser.Function, values []string, overrideOutbound *Outbound) (err error)) FunctionParser

EmptyKeyPlainParserFactory only accepts function with empty key.

func IpParserFactory

func IpParserFactory(callback func(f *config_parser.Function, cidrs []netip.Prefix, overrideOutbound *Outbound) (err error)) FunctionParser

func IpVersionParserFactory

func IpVersionParserFactory(callback func(f *config_parser.Function, ipVersion consts.IpVersionType, overrideOutbound *Outbound) (err error)) FunctionParser

func L4ProtoParserFactory

func L4ProtoParserFactory(callback func(f *config_parser.Function, l4protoType consts.L4ProtoType, overrideOutbound *Outbound) (err error)) FunctionParser

func MacParserFactory

func MacParserFactory(callback func(f *config_parser.Function, macAddrs [][6]byte, overrideOutbound *Outbound) (err error)) FunctionParser

func PlainParserFactory

func PlainParserFactory(callback func(f *config_parser.Function, key string, paramValueGroup []string, overrideOutbound *Outbound) (err error)) FunctionParser

PlainParserFactory is for style unity.

func PortRangeParserFactory

func PortRangeParserFactory(callback func(f *config_parser.Function, portRanges [][2]uint16, overrideOutbound *Outbound) (err error)) FunctionParser

func ProcessNameParserFactory

func ProcessNameParserFactory(callback func(f *config_parser.Function, procNames [][consts.TaskCommLen]byte, overrideOutbound *Outbound) (err error)) FunctionParser

type MergeAndSortRulesOptimizer

type MergeAndSortRulesOptimizer struct {
}

func (*MergeAndSortRulesOptimizer) Optimize

type Outbound

type Outbound struct {
	Name string
	Mark uint32
	Must bool
}

func ParseOutbound

func ParseOutbound(rawOutbound *config_parser.Function) (outbound *Outbound, err error)

type RulesBuilder

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

func NewRulesBuilder

func NewRulesBuilder(log *logrus.Logger) *RulesBuilder

func (*RulesBuilder) Apply

func (b *RulesBuilder) Apply(rules []*config_parser.RoutingRule) (err error)

func (*RulesBuilder) RegisterFunctionParser

func (b *RulesBuilder) RegisterFunctionParser(funcName string, parser FunctionParser)

type RulesOptimizer

type RulesOptimizer interface {
	Optimize(rules []*config_parser.RoutingRule) ([]*config_parser.RoutingRule, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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