plugins

package
v1.2.16 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package plugins provides a framework for dynamically loading and managing plugins

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadPlugin added in v1.2.4

func DownloadPlugin(url string, extension string) (string, error)

DownloadPlugin downloads a plugin from a URL and returns the local file path

func LoadPlugins

func LoadPlugins(loader PluginLoader, config *Config) ([]schemas.Plugin, error)

LoadPlugins loads the plugins from the config

Types

type Config

type Config struct {
	Plugins []DynamicPluginConfig `json:"plugins"`
}

Config is the configuration for the plugins framework

type DynamicPlugin

type DynamicPlugin struct {
	Enabled bool
	Path    string

	Config any
	// contains filtered or unexported fields
}

DynamicPlugin is the interface for a dynamic plugin

func (*DynamicPlugin) Cleanup

func (dp *DynamicPlugin) Cleanup() error

Cleanup is invoked by core/bifrost.go during plugin unload, reload, and shutdown

func (*DynamicPlugin) GetName

func (dp *DynamicPlugin) GetName() string

GetName returns the name of the plugin

func (*DynamicPlugin) HTTPTransportPostHook added in v1.2.9

func (dp *DynamicPlugin) HTTPTransportPostHook(ctx *schemas.BifrostContext, req *schemas.HTTPRequest, resp *schemas.HTTPResponse) error

HTTPTransportPostHook intercepts HTTP responses at the transport layer after exiting Bifrost core

func (*DynamicPlugin) HTTPTransportPreHook added in v1.2.9

func (dp *DynamicPlugin) HTTPTransportPreHook(ctx *schemas.BifrostContext, req *schemas.HTTPRequest) (*schemas.HTTPResponse, error)

HTTPTransportPreHook intercepts HTTP requests at the transport layer before entering Bifrost core

func (*DynamicPlugin) HTTPTransportStreamChunkHook added in v1.2.15

func (dp *DynamicPlugin) HTTPTransportStreamChunkHook(ctx *schemas.BifrostContext, req *schemas.HTTPRequest, stream *schemas.BifrostStreamChunk) (*schemas.BifrostStreamChunk, error)

HTTPTransportStreamChunkHook intercepts streaming chunks before they are written to the client

func (*DynamicPlugin) PostHook

PostHook is invoked by PluginPipeline.RunPostHooks in core/bifrost.go

func (*DynamicPlugin) PreHook

PreHook is invoked by PluginPipeline.RunPreHooks in core/bifrost.go

type DynamicPluginConfig

type DynamicPluginConfig struct {
	Path    string `json:"path"`
	Name    string `json:"name"`
	Enabled bool   `json:"enabled"`
	Config  any    `json:"config"`
}

type PluginLoader added in v1.2.4

type PluginLoader interface {
	LoadDynamicPlugin(path string, config any) (schemas.Plugin, error)
}

PluginLoader is the contract for a plugin loader

type SharedObjectPluginLoader added in v1.2.4

type SharedObjectPluginLoader struct{}

SharedObjectPluginLoader is the loader for shared object plugins

func (*SharedObjectPluginLoader) LoadDynamicPlugin added in v1.2.4

func (l *SharedObjectPluginLoader) LoadDynamicPlugin(path string, config any) (schemas.Plugin, error)

LoadDynamicPlugin loads a dynamic plugin from a shared object file

Jump to

Keyboard shortcuts

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