plugins

package
v0.0.1-beta.8 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package plugins provides plugin management and loading functionality for XRP.

This package handles the secure loading, validation, and management of Go plugins that implement the XRP plugin interface. It supports:

- Secure plugin file validation (permissions, paths, symlinks) - Simple GetPlugin() function-based plugin loading - Plugin lifecycle management and hot-reloading - Thread-safe plugin registry and retrieval - Comprehensive security controls and sandboxing

Plugin Loading Process:

1. Security validation: Check file permissions, paths, and prevent symlink attacks 2. Plugin loading: Load shared library and look up GetPlugin() function 3. Instance creation: Call GetPlugin() to get a fresh plugin instance 4. Interface validation: Ensure plugin implements required methods 5. Registration: Store plugin for efficient retrieval during request processing

Example plugin implementation:

func GetPlugin() xrpplugin.Plugin {
    return &MyPlugin{}
}

Security features include validation of file permissions, prevention of directory traversal attacks, and restriction to allowed plugin directories. All plugin loading operations are logged for security auditing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoadedPlugin

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

func (*LoadedPlugin) ProcessHTMLTree

func (lp *LoadedPlugin) ProcessHTMLTree(ctx context.Context, url *url.URL, node *html.Node) error

func (*LoadedPlugin) ProcessXMLTree

func (lp *LoadedPlugin) ProcessXMLTree(ctx context.Context, url *url.URL, doc *etree.Document) error

type Manager

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

func New

func New() (*Manager, error)

func (*Manager) GetPlugin

func (m *Manager) GetPlugin(path, name string) *LoadedPlugin

func (*Manager) LoadPlugins

func (m *Manager) LoadPlugins(cfg *config.Config) error

Jump to

Keyboard shortcuts

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