sequence

package
v5.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const PluginType = "sequence"

Variables

This section is empty.

Functions

func Init

func Init(bp *coremain.BP, args interface{}) (coremain.Plugin, error)

func MustRegQuickSetup

func MustRegQuickSetup(typ string, f QuickSetupFunc)

func RegQuickSetup

func RegQuickSetup(typ string, f QuickSetupFunc) error

Types

type Args

type Args = []RuleArgs

type BQ

type BQ interface {
	M() *coremain.Mosdns
	L() *zap.Logger
}

func NewBQ

func NewBQ(m *coremain.Mosdns, l *zap.Logger) BQ

type ChainWalker

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

func NewTestChainWalker

func NewTestChainWalker(nextExec RecursiveExecutable) ChainWalker

NewTestChainWalker returns a ChainWalker which ChainWalker.ExecNext will always call nextExec with a noop ChainWalker. Note: As the function name indicates, this is for tests only.

func (*ChainWalker) ExecNext

func (w *ChainWalker) ExecNext(ctx context.Context, qCtx *query_context.Context) error

type Executable

type Executable interface {
	Exec(ctx context.Context, qCtx *query_context.Context) error
}

Executable represents something that is executable.

func ToExecutable

func ToExecutable(v any) Executable

type ExecutableFunc

type ExecutableFunc func(ctx context.Context, qCtx *query_context.Context) error

func (ExecutableFunc) Exec

type MatchConfig

type MatchConfig struct {
	Tag     string `yaml:"tag"`
	Type    string `yaml:"type"`
	Args    string `yaml:"args"`
	Reverse bool   `yaml:"reverse"`
}

type MatchFunc

type MatchFunc func(ctx context.Context, qCtx *query_context.Context) (bool, error)

func (MatchFunc) Match

func (f MatchFunc) Match(ctx context.Context, qCtx *query_context.Context) (bool, error)

type Matcher

type Matcher interface {
	Match(ctx context.Context, qCtx *query_context.Context) (bool, error)
}

Matcher represents a matcher that can match a certain patten in Context.

type QuickConfigurable

type QuickConfigurable interface {
	QuickConfigure(args string) (any, error)
}

QuickConfigurable can configure an exiting plugin with additional args. Expecting return is an Executable or RecursiveExecutable or Matcher.

type QuickSetupFunc

type QuickSetupFunc func(bq BQ, args string) (any, error)

QuickSetupFunc configures an Executable or RecursiveExecutable or Matcher. with a simple string args.

func GetQuickSetup

func GetQuickSetup(typ string) QuickSetupFunc

type RecursiveExecutable

type RecursiveExecutable interface {
	Exec(ctx context.Context, qCtx *query_context.Context, next ChainWalker) error
}

RecursiveExecutable represents something that is executable and requires stack.

type RecursiveExecutableFunc

type RecursiveExecutableFunc func(ctx context.Context, qCtx *query_context.Context, next ChainWalker) error

func (RecursiveExecutableFunc) Exec

type RuleArgs

type RuleArgs struct {
	Matches []string `yaml:"matches"`
	Exec    string   `yaml:"exec"`
}

type RuleConfig

type RuleConfig struct {
	Matches []MatchConfig `yaml:"matches"`
	Tag     string        `yaml:"tag"`
	Type    string        `yaml:"type"`
	Args    string        `yaml:"args"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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