plugin

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package plugin provides tools for loading and registering proxy plugins

SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	// Namespace is the namespace for the extra_config section
	Namespace = "github.com/devopsfaith/krakend/proxy/plugin"
)

Variables

This section is empty.

Functions

func LoadModifiers

func LoadModifiers(path, pattern string, rmf RegisterModifierFunc) (int, error)

LoadModifiers scans the given path using the pattern and registers all the found modifier plugins into the rmf

func LoadModifiersWithLogger

func LoadModifiersWithLogger(path, pattern string, rmf RegisterModifierFunc, logger logging.Logger) (int, error)

LoadModifiersWithLogger scans the given path using the pattern and registers all the found modifier plugins into the rmf

func RegisterModifier

func RegisterModifier(
	name string,
	modifierFactory func(map[string]interface{}) func(interface{}) (interface{}, error),
	appliesToRequest bool,
	appliesToResponse bool,
)

RegisterModifier registers the injected modifier factory with the given name at the selected namespace

Types

type LoggerRegisterer

type LoggerRegisterer interface {
	RegisterLogger(interface{})
}

type ModifierFactory

type ModifierFactory func(map[string]interface{}) func(interface{}) (interface{}, error)

ModifierFactory is a function that, given a config passed as a map, returns a modifier

func GetRequestModifier

func GetRequestModifier(name string) (ModifierFactory, bool)

GetRequestModifier returns a ModifierFactory from the request namespace by name

func GetResponseModifier

func GetResponseModifier(name string) (ModifierFactory, bool)

GetResponseModifier returns a ModifierFactory from the response namespace by name

type Plugin

type Plugin interface {
	Lookup(name string) (plugin.Symbol, error)
}

Plugin is the interface of the loaded plugins

type RegisterModifierFunc

type RegisterModifierFunc func(
	name string,
	modifierFactory func(map[string]interface{}) func(interface{}) (interface{}, error),
	appliesToRequest bool,
	appliesToResponse bool,
)

RegisterModifierFunc type is the function passed to the loaded Registerers

type Registerer

type Registerer interface {
	RegisterModifiers(func(
		name string,
		modifierFactory func(map[string]interface{}) func(interface{}) (interface{}, error),
		appliesToRequest bool,
		appliesToResponse bool,
	))
}

Registerer defines the interface for the plugins to expose in order to be able to be loaded/registered

Directories

Path Synopsis
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0

Jump to

Keyboard shortcuts

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