plugins

package
v3.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 34 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupLocalPlugins

func SetupLocalPlugins(plugins map[string]LocalDescriptor) error

SetupLocalPlugins setup local plugins environment.

func SetupRemotePlugins

func SetupRemotePlugins(client *Client, plugins map[string]Descriptor) error

SetupRemotePlugins setup remote plugins environment.

Types

type Builder

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

Builder is a plugin builder.

func NewBuilder

func NewBuilder(client *Client, plugins map[string]Descriptor, localPlugins map[string]LocalDescriptor) (*Builder, error)

NewBuilder creates a new Builder.

func (Builder) Build

func (b Builder) Build(pName string, config map[string]interface{}, middlewareName string) (Constructor, error)

Build builds a middleware plugin.

func (Builder) BuildProvider

func (b Builder) BuildProvider(pName string, config map[string]interface{}) (provider.Provider, error)

BuildProvider builds a plugin's provider.

type Client

type Client struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client a Traefik plugins client.

func NewClient

func NewClient(opts ClientOptions) (*Client, error)

NewClient creates a new Traefik plugins client.

func (*Client) Check

func (c *Client) Check(ctx context.Context, pName, pVersion, hash string) error

Check checks the plugin archive integrity.

func (*Client) CleanArchives

func (c *Client) CleanArchives(plugins map[string]Descriptor) error

CleanArchives cleans plugins archives.

func (*Client) Download

func (c *Client) Download(ctx context.Context, pName, pVersion string) (string, error)

Download downloads a plugin archive.

func (*Client) GoPath

func (c *Client) GoPath() string

GoPath gets the plugins GoPath.

func (*Client) ReadManifest

func (c *Client) ReadManifest(moduleName string) (*Manifest, error)

ReadManifest reads a plugin manifest.

func (*Client) ResetAll

func (c *Client) ResetAll() error

ResetAll resets all plugins related directories.

func (*Client) Unzip

func (c *Client) Unzip(pName, pVersion string) error

Unzip unzip a plugin archive.

func (*Client) WriteState

func (c *Client) WriteState(plugins map[string]Descriptor) error

WriteState writes the plugins state files.

type ClientOptions

type ClientOptions struct {
	Output string
}

ClientOptions the options of a Traefik plugins client.

type Constructor

type Constructor func(context.Context, http.Handler) (http.Handler, error)

Constructor creates a plugin handler.

type Descriptor

type Descriptor struct {
	// ModuleName (required)
	ModuleName string `` /* 133-byte string literal not displayed */

	// Version (required)
	Version string `description:"plugin's version." json:"version,omitempty" toml:"version,omitempty" yaml:"version,omitempty" export:"true"`
}

Descriptor The static part of a plugin configuration.

type LocalDescriptor

type LocalDescriptor struct {
	// ModuleName (required)
	ModuleName string `` /* 133-byte string literal not displayed */
}

LocalDescriptor The static part of a local plugin configuration.

type Manifest

type Manifest struct {
	DisplayName   string                 `yaml:"displayName"`
	Type          string                 `yaml:"type"`
	Runtime       string                 `yaml:"runtime"`
	WasmPath      string                 `yaml:"wasmPath"`
	Import        string                 `yaml:"import"`
	BasePkg       string                 `yaml:"basePkg"`
	Compatibility string                 `yaml:"compatibility"`
	Summary       string                 `yaml:"summary"`
	TestData      map[string]interface{} `yaml:"testData"`
}

Manifest The plugin manifest.

func ReadManifest

func ReadManifest(goPath, moduleName string) (*Manifest, error)

ReadManifest reads a plugin manifest.

func (*Manifest) IsYaegiPlugin

func (m *Manifest) IsYaegiPlugin() bool

IsYaegiPlugin returns true if the plugin is a Yaegi plugin.

type PP

type PP interface {
	Init() error
	Provide(cfgChan chan<- json.Marshaler) error
	Stop() error
}

PP the interface of a plugin's provider.

type Provider

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

Provider is a plugin's provider wrapper.

func (*Provider) Init

func (p *Provider) Init() error

Init wraps the Init method of a plugin.

func (*Provider) Provide

func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error

Provide wraps the Provide method of a plugin.

type WasmMiddleware

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

WasmMiddleware is an HTTP handler plugin wrapper.

func (WasmMiddleware) NewHandler

func (m WasmMiddleware) NewHandler(ctx context.Context, next http.Handler) (http.Handler, error)

NewHandler creates a new HTTP handler.

type YaegiMiddleware

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

YaegiMiddleware is an HTTP handler plugin wrapper.

func (*YaegiMiddleware) NewHandler

func (m *YaegiMiddleware) NewHandler(ctx context.Context, next http.Handler) (http.Handler, error)

NewHandler creates a new HTTP handler.

Jump to

Keyboard shortcuts

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