plugins

package
v3.7.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 38 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(manager *Manager, 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(manager *Manager, 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]any, middlewareName string) (Constructor, error)

Build builds a middleware plugin.

func (Builder) BuildProvider

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

BuildProvider builds a plugin's provider.

type Constructor

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

Constructor creates a plugin handler.

type ContextApplier added in v3.1.0

type ContextApplier func(ctx context.Context) context.Context

func InstantiateHost added in v3.1.0

func InstantiateHost(ctx context.Context, runtime wazero.Runtime, mod wazero.CompiledModule, settings Settings) (ContextApplier, error)

InstantiateHost instantiates the Host module according to the guest requirements (for now only SocketExtensions).

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"`

	// Hash (optional)
	Hash string `description:"plugin's hash to validate'" json:"hash,omitempty" toml:"hash,omitempty" yaml:"hash,omitempty" export:"true"`

	// Settings (optional)
	Settings Settings `` /* 154-byte string literal not displayed */
}

Descriptor The static part of a plugin configuration.

type LocalDescriptor

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

	// Settings (optional)
	Settings Settings `` /* 154-byte string literal not displayed */
}

LocalDescriptor The static part of a local plugin configuration.

type Manager added in v3.5.3

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

Manager manages Traefik plugins lifecycle operations including storage, and manifest reading.

func NewManager added in v3.5.3

func NewManager(downloader PluginDownloader, opts ManagerOptions) (*Manager, error)

NewManager creates a new Traefik plugins manager.

func (*Manager) CleanArchives added in v3.5.3

func (m *Manager) CleanArchives(plugins map[string]Descriptor) error

CleanArchives cleans plugins archives.

func (*Manager) GoPath added in v3.5.3

func (m *Manager) GoPath() string

GoPath gets the plugins GoPath.

func (*Manager) InstallPlugin added in v3.5.3

func (m *Manager) InstallPlugin(ctx context.Context, plugin Descriptor) error

InstallPlugin download and unzip the given plugin.

func (*Manager) ReadManifest added in v3.5.3

func (m *Manager) ReadManifest(moduleName string) (*Manifest, error)

ReadManifest reads a plugin manifest.

func (*Manager) ResetAll added in v3.5.3

func (m *Manager) ResetAll() error

ResetAll resets all plugins related directories.

func (*Manager) WriteState added in v3.5.3

func (m *Manager) WriteState(plugins map[string]Descriptor) error

WriteState writes the plugins state files.

type ManagerOptions added in v3.5.3

type ManagerOptions struct {
	Output string
}

ManagerOptions the options of a Traefik plugins manager.

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"`
	UseUnsafe     bool           `yaml:"useUnsafe"`
	TestData      map[string]any `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 PluginDownloader added in v3.5.3

type PluginDownloader interface {
	// Download downloads a plugin archive and returns its hash.
	Download(ctx context.Context, pName, pVersion string) (string, error)
	// Check checks the plugin archive integrity against a known hash.
	Check(ctx context.Context, pName, pVersion, hash string) error
}

PluginDownloader defines the interface for downloading and validating plugins from remote sources.

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 RegistryDownloader added in v3.5.3

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

RegistryDownloader implements PluginDownloader for HTTP-based plugin downloads.

func NewRegistryDownloader added in v3.5.3

func NewRegistryDownloader(opts RegistryDownloaderOptions) (*RegistryDownloader, error)

NewRegistryDownloader creates a new HTTP-based plugin downloader.

func (*RegistryDownloader) Check added in v3.5.3

func (d *RegistryDownloader) Check(ctx context.Context, pName, pVersion, hash string) error

Check checks the plugin archive integrity.

func (*RegistryDownloader) Download added in v3.5.3

func (d *RegistryDownloader) Download(ctx context.Context, pName, pVersion string) (string, error)

Download downloads a plugin archive.

type RegistryDownloaderOptions added in v3.5.3

type RegistryDownloaderOptions struct {
	HTTPClient   *http.Client
	ArchivesPath string
}

RegistryDownloaderOptions holds configuration options for creating a RegistryDownloader.

type Settings added in v3.1.0

type Settings struct {
	Envs      []string `` /* 131-byte string literal not displayed */
	Mounts    []string `description:"Directory to mount to the wasm guest." json:"mounts,omitempty" toml:"mounts,omitempty" yaml:"mounts,omitempty"`
	UseUnsafe bool     `` /* 147-byte string literal not displayed */
}

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