plugins

package
v0.0.0-...-c02a141 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPluginMalformed is returned when the plugin is missing a required export.
	ErrPluginMalformed = errors.New("malformed plugin: MUST export Name string, Intialize func() (map[string]string, error) and ProcessTransactions func(chan<- HTTPTransaction, map[string]string)")
)

Functions

This section is empty.

Types

type HTTPTransaction

type HTTPTransaction struct {
	Request  http.Request
	Response http.Response
}

HTTPTransaction represents a complete request - response flow.

type Plugin

type Plugin interface {
	// Name of the plugin.
	Name() string

	// Initialize is where you should do your plugin's setup, like defining command line flags.
	// You are allowed to return a PluginArguments of arguments that will be passed to your ProcessTransactions function.
	Initialize() (PluginArguments, error)

	// ProcessTransactions takes a chan that produces request - response pair and does something.
	// Judas plugins should implement this function to process request - response pairs as they are generated.
	// Requests and responses will be passed by value, allowing each plugin to run in its own goroutine.
	ProcessTransactions(<-chan HTTPTransaction, PluginArguments)
}

Plugin contains functions and variables that Judas will be looking for in your plugin. Plugins will be loaded from any .so file in the same directory as the judas executable.

func New

func New(path string) (Plugin, error)

New loads a JudasPlugin from a file path. TODO: Add code signing.

type PluginArguments

type PluginArguments map[string]interface{}

PluginArguments is a map[string]interface{} of arguments to be passed to your ProcessTransactions function.

Jump to

Keyboard shortcuts

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