plugins

package
v3.0.0-beta14 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPlugin

func AddPlugin(name, description string, plugin PluginInterface)

AddPlugin adds a plugin.

func GetPluginDescription

func GetPluginDescription(name string) string

GetPluginDescription returns a plugin description.

func GetPlugins

func GetPlugins() map[string]PluginInterface

GetPlugins returns all plugins.

Types

type BasePlugin

type BasePlugin struct {
	StepDefinitions map[string]*StepDefinition
}

BasePlugin represents a base plugin.

func (*BasePlugin) GetSteps

func (p *BasePlugin) GetSteps() map[string]*StepDefinition

GetSteps returns all steps.

func (*BasePlugin) Primitives

func (p *BasePlugin) Primitives()

Primitives initializes the plugin.

func (*BasePlugin) RegisterStep

func (p *BasePlugin) RegisterStep(step *StepDefinition)

RegisterStep registers a step.

func (*BasePlugin) RunStep

func (p *BasePlugin) RunStep(ctx context.Context, stepsgen map[string]any, step *Step) ([]*metrics.Metric, error)

RunStep runs a step.

func (*BasePlugin) StepExists

func (p *BasePlugin) StepExists(name string) bool

StepExists returns true if the step exists.

type PluginInterface

type PluginInterface interface {
	// Init initializes the plugin.
	Init()
	// Primitives returns the plugin primitives.
	Primitives()
	// RunStep runs a step.
	RunStep(context.Context, map[string]any, *Step) ([]*metrics.Metric, error)
	// RegisterStep registers a step.
	RegisterStep(*StepDefinition)
	// StepExists returns true if the step exists.
	StepExists(string) bool
	// GetSteps returns all steps.
	GetSteps() map[string]*StepDefinition
}

PluginInterface represents a plugin.

func GetPlugin

func GetPlugin(name string) PluginInterface

GetPlugin returns a plugin.

type Step

type Step struct {
	// Name is the name of the step.
	Name string
	// Args is the arguments of the step.
	Args map[string]string
	// Timeout is the timeout of the step.
	Timeout int
	// Negate is true if the step should be negated.
	Negate bool
}

Step represents a step.

type StepDefinition

type StepDefinition struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Params      []StepParam `json:"params"`
	Fn          stepFn      `json:"-"`
}

StepDefinition represents a step definition.

type StepParam

type StepParam struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Optional    bool   `json:"optional"`
}

StepParam returns the value of a step parameter

Directories

Path Synopsis
Package all runs all scenarios
Package all runs all scenarios
collector
dns
ftp
tcp
tls
udp
misc

Jump to

Keyboard shortcuts

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