Documentation
¶
Index ¶
- Constants
- type AuthPlugin
- type ConfigMigration
- type ConfigMigrator
- func (cm *ConfigMigrator) LoadConfig(path string) (map[string]interface{}, error)
- func (cm *ConfigMigrator) MigrateConfig(config map[string]interface{}) (map[string]interface{}, error)
- func (cm *ConfigMigrator) RegisterMigration(migration ConfigMigration)
- func (cm *ConfigMigrator) SaveConfig(config map[string]interface{}, path string) error
- func (cm *ConfigMigrator) ValidateConfig(config map[string]interface{}) error
- type ConfigVersion
- type DependencyGraph
- type DependencyManager
- func (dm *DependencyManager) CanUnload(pluginName string) (bool, []string)
- func (dm *DependencyManager) GetDependents(pluginName string) []string
- func (dm *DependencyManager) GetLoadOrder() ([]string, error)
- func (dm *DependencyManager) GetPlugin(name string) (*VersionedPlugin, error)
- func (dm *DependencyManager) RegisterPlugin(plugin *VersionedPlugin) error
- func (dm *DependencyManager) ResolveDependencies() ([]string, error)
- func (dm *DependencyManager) UnregisterPlugin(name string) error
- type DependencyNode
- type DownloadPlugin
- type DownloadRequest
- type DownloadResponse
- type ErrorCollector
- func (ec *ErrorCollector) Add(err *PluginError)
- func (ec *ErrorCollector) AddError(code PluginErrorCode, err error)
- func (ec *ErrorCollector) Error() string
- func (ec *ErrorCollector) GetCriticalErrors() []*PluginError
- func (ec *ErrorCollector) GetErrors() []*PluginError
- func (ec *ErrorCollector) HasErrors() bool
- func (ec *ErrorCollector) Summary() map[string]int
- type HookType
- type HotReloadConfig
- type HotReloadManager
- type LoaderConfig
- type Plugin
- type PluginConfigManager
- type PluginError
- func ErrPluginAlreadyExists(name string) *PluginError
- func ErrPluginInitError(name string, cause error) *PluginError
- func ErrPluginLoadError(path string, cause error) *PluginError
- func ErrPluginNotFoundError(name string) *PluginError
- func ErrResourceLimitError(resource string, limit interface{}, actual interface{}) *PluginError
- func ErrSecurityViolationError(operation string, details map[string]interface{}) *PluginError
- func NewPluginError(code PluginErrorCode, message string) *PluginError
- func NewPluginErrorWithCause(code PluginErrorCode, message string, cause error) *PluginError
- func (pe *PluginError) Error() string
- func (pe *PluginError) GetSeverity() string
- func (pe *PluginError) IsRetryable() bool
- func (pe *PluginError) Unwrap() error
- func (pe *PluginError) WithDetails(details map[string]interface{}) *PluginError
- func (pe *PluginError) WithPlugin(name, path string) *PluginError
- func (pe *PluginError) WithStackTrace() *PluginError
- func (pe *PluginError) WithSuggestions(suggestions ...string) *PluginError
- type PluginErrorCode
- type PluginFileInfo
- type PluginHook
- type PluginInfo
- type PluginLoader
- func (pl *PluginLoader) AddSearchPath(path string) error
- func (pl *PluginLoader) DiscoverPlugins() ([]string, error)
- func (pl *PluginLoader) GetLoadedPlugins() map[string]*PluginInfo
- func (pl *PluginLoader) GetPluginByName(name string) (Plugin, error)
- func (pl *PluginLoader) GetPluginsByType(pluginType string) []Plugin
- func (pl *PluginLoader) GetSearchPaths() []string
- func (pl *PluginLoader) Load(path string) (Plugin, error)
- func (pl *PluginLoader) LoadAll() ([]Plugin, []error)
- func (pl *PluginLoader) LoadFromSearchPath(filename string) (Plugin, error)
- func (pl *PluginLoader) ReloadPlugin(path string) (Plugin, error)
- func (pl *PluginLoader) RemoveSearchPath(path string)
- func (pl *PluginLoader) UnloadAll() []error
- func (pl *PluginLoader) UnloadPlugin(path string) error
- func (pl *PluginLoader) VerifyPlugin(path string) error
- type PluginManager
- func (pm *PluginManager) AddHook(hookType HookType, hookFunc PluginHook)
- func (pm *PluginManager) ClearErrors()
- func (pm *PluginManager) Close() error
- func (pm *PluginManager) ExecuteHook(hook HookType, data interface{}) error
- func (pm *PluginManager) Get(name string) (Plugin, error)
- func (pm *PluginManager) GetErrorCollector() *ErrorCollector
- func (pm *PluginManager) GetPluginStats() map[string]interface{}
- func (pm *PluginManager) ListPlugins() []string
- func (pm *PluginManager) LoadFromDirectory(dir string) error
- func (pm *PluginManager) Register(plugin Plugin) error
- func (pm *PluginManager) RemoveHooks(hookType HookType)
- func (pm *PluginManager) SetSecurity(security *PluginSecurity)
- func (pm *PluginManager) Unregister(name string) error
- type PluginSecurity
- type ProtocolPlugin
- type ResourceMonitor
- type SecurePlugin
- type SecurePluginExecutor
- type SecurityValidator
- type StoragePlugin
- type TransformPlugin
- type Version
- type VersionedPlugin
Constants ¶
const ( PreDownloadHook = types.PreDownloadHook PostDownloadHook = types.PostDownloadHook PreStoreHook = types.PreStoreHook PostStoreHook = types.PostStoreHook AuthHook = types.AuthHook TransformHook = types.TransformHook )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthPlugin ¶
type ConfigMigration ¶
type ConfigMigration struct {
FromVersion int
ToVersion int
Description string
Migrate func(config map[string]interface{}) (map[string]interface{}, error)
}
ConfigMigration represents a migration from one version to another
func DefaultMigrations ¶
func DefaultMigrations() []ConfigMigration
DefaultMigrations returns common configuration migrations
type ConfigMigrator ¶
type ConfigMigrator struct {
// contains filtered or unexported fields
}
ConfigMigrator handles configuration migrations
func NewConfigMigrator ¶
func NewConfigMigrator(currentVersion int, backupDir string) *ConfigMigrator
NewConfigMigrator creates a new configuration migrator
func (*ConfigMigrator) LoadConfig ¶
func (cm *ConfigMigrator) LoadConfig(path string) (map[string]interface{}, error)
LoadConfig loads a configuration from file
func (*ConfigMigrator) MigrateConfig ¶
func (cm *ConfigMigrator) MigrateConfig(config map[string]interface{}) (map[string]interface{}, error)
MigrateConfig migrates a configuration to the current version
func (*ConfigMigrator) RegisterMigration ¶
func (cm *ConfigMigrator) RegisterMigration(migration ConfigMigration)
RegisterMigration registers a configuration migration
func (*ConfigMigrator) SaveConfig ¶
func (cm *ConfigMigrator) SaveConfig(config map[string]interface{}, path string) error
SaveConfig saves a configuration to file
func (*ConfigMigrator) ValidateConfig ¶
func (cm *ConfigMigrator) ValidateConfig(config map[string]interface{}) error
ValidateConfig validates a configuration against current schema
type ConfigVersion ¶
ConfigVersion represents a configuration version
type DependencyGraph ¶
type DependencyGraph struct {
// contains filtered or unexported fields
}
DependencyGraph represents plugin dependencies
func NewDependencyGraph ¶
func NewDependencyGraph() *DependencyGraph
NewDependencyGraph creates a new dependency graph
func (*DependencyGraph) AddNode ¶
func (dg *DependencyGraph) AddNode(name string, version *Version, plugin Plugin, dependencies []string)
AddNode adds a plugin node to the graph
func (*DependencyGraph) GetLoadOrder ¶
func (dg *DependencyGraph) GetLoadOrder() []string
GetLoadOrder returns the order in which plugins should be loaded
func (*DependencyGraph) Resolve ¶
func (dg *DependencyGraph) Resolve() ([]string, error)
Resolve returns the plugins in the order they should be loaded
func (*DependencyGraph) ValidateDependencies ¶
func (dg *DependencyGraph) ValidateDependencies() error
ValidateDependencies checks if all dependencies can be satisfied
type DependencyManager ¶
type DependencyManager struct {
// contains filtered or unexported fields
}
DependencyManager manages plugin dependencies
func NewDependencyManager ¶
func NewDependencyManager() *DependencyManager
NewDependencyManager creates a new dependency manager
func (*DependencyManager) CanUnload ¶
func (dm *DependencyManager) CanUnload(pluginName string) (bool, []string)
CanUnload checks if a plugin can be safely unloaded
func (*DependencyManager) GetDependents ¶
func (dm *DependencyManager) GetDependents(pluginName string) []string
GetDependents returns plugins that depend on the given plugin
func (*DependencyManager) GetLoadOrder ¶
func (dm *DependencyManager) GetLoadOrder() ([]string, error)
GetLoadOrder returns the order in which plugins should be loaded
func (*DependencyManager) GetPlugin ¶
func (dm *DependencyManager) GetPlugin(name string) (*VersionedPlugin, error)
GetPlugin returns a registered plugin by name
func (*DependencyManager) RegisterPlugin ¶
func (dm *DependencyManager) RegisterPlugin(plugin *VersionedPlugin) error
RegisterPlugin registers a versioned plugin with its dependencies
func (*DependencyManager) ResolveDependencies ¶
func (dm *DependencyManager) ResolveDependencies() ([]string, error)
ResolveDependencies resolves all plugin dependencies
func (*DependencyManager) UnregisterPlugin ¶
func (dm *DependencyManager) UnregisterPlugin(name string) error
UnregisterPlugin removes a plugin from the dependency manager
type DependencyNode ¶
DependencyNode represents a plugin and its dependencies
type DownloadPlugin ¶
type DownloadPlugin interface {
Plugin
PreDownload(ctx context.Context, req *DownloadRequest) error
PostDownload(ctx context.Context, resp *DownloadResponse) error
}
type DownloadRequest ¶
type DownloadRequest struct {
URL string
Options *types.DownloadOptions
}
DownloadRequest represents a download request for plugins
type DownloadResponse ¶
type DownloadResponse struct {
Stats *types.DownloadStats
Error error
}
DownloadResponse represents a download response for plugins
type ErrorCollector ¶
type ErrorCollector struct {
// contains filtered or unexported fields
}
ErrorCollector collects multiple plugin errors
func NewErrorCollector ¶
func NewErrorCollector() *ErrorCollector
NewErrorCollector creates a new error collector
func (*ErrorCollector) Add ¶
func (ec *ErrorCollector) Add(err *PluginError)
Add adds an error to the collector
func (*ErrorCollector) AddError ¶
func (ec *ErrorCollector) AddError(code PluginErrorCode, err error)
AddError adds a generic error by converting it to PluginError
func (*ErrorCollector) Error ¶
func (ec *ErrorCollector) Error() string
Error implements the error interface for ErrorCollector
func (*ErrorCollector) GetCriticalErrors ¶
func (ec *ErrorCollector) GetCriticalErrors() []*PluginError
GetCriticalErrors returns only critical errors
func (*ErrorCollector) GetErrors ¶
func (ec *ErrorCollector) GetErrors() []*PluginError
GetErrors returns all collected errors
func (*ErrorCollector) HasErrors ¶
func (ec *ErrorCollector) HasErrors() bool
HasErrors returns true if there are any errors
func (*ErrorCollector) Summary ¶
func (ec *ErrorCollector) Summary() map[string]int
Summary returns a summary of all errors
type HotReloadConfig ¶
type HotReloadConfig struct {
Enabled bool `json:"enabled"`
WatchDirectories []string `json:"watch_directories"`
CheckInterval time.Duration `json:"check_interval"`
Debounce time.Duration `json:"debounce"`
AutoRestart bool `json:"auto_restart"`
MaxRetries int `json:"max_retries"`
}
HotReloadConfig configures hot reload behavior
func DefaultHotReloadConfig ¶
func DefaultHotReloadConfig() *HotReloadConfig
DefaultHotReloadConfig returns default hot reload configuration
type HotReloadManager ¶
type HotReloadManager struct {
// contains filtered or unexported fields
}
HotReloadManager manages plugin hot reloading
func NewHotReloadManager ¶
func NewHotReloadManager(config *HotReloadConfig, manager *PluginManager, depManager *DependencyManager) (*HotReloadManager, error)
NewHotReloadManager creates a new hot reload manager
func (*HotReloadManager) GetPluginInfo ¶
func (hrm *HotReloadManager) GetPluginInfo(name string) (PluginFileInfo, bool)
GetPluginInfo returns information about a tracked plugin file
func (*HotReloadManager) GetTrackedPlugins ¶
func (hrm *HotReloadManager) GetTrackedPlugins() []string
GetTrackedPlugins returns all tracked plugin names
func (*HotReloadManager) Start ¶
func (hrm *HotReloadManager) Start() error
Start begins hot reload monitoring
func (*HotReloadManager) Stop ¶
func (hrm *HotReloadManager) Stop() error
Stop stops hot reload monitoring
type LoaderConfig ¶
type LoaderConfig struct {
SearchPaths []string `json:"search_paths"`
AllowedPaths []string `json:"allowed_paths,omitempty"`
BlockedPaths []string `json:"blocked_paths,omitempty"`
VerifyChecksum bool `json:"verify_checksum"`
MaxPluginSize int64 `json:"max_plugin_size"` // in bytes
}
LoaderConfig contains configuration for the plugin loader
type Plugin ¶
type Plugin interface {
Name() string
Version() string
Init(config map[string]interface{}) error
Close() error
// Security validation method
ValidateAccess(operation string, resource string) error
}
Core plugin interfaces
type PluginConfigManager ¶
type PluginConfigManager struct {
// contains filtered or unexported fields
}
PluginConfigManager manages plugin-specific configurations
func NewPluginConfigManager ¶
func NewPluginConfigManager(configDir string, currentVersion int) *PluginConfigManager
NewPluginConfigManager creates a new plugin configuration manager
func (*PluginConfigManager) LoadPluginConfig ¶
func (pcm *PluginConfigManager) LoadPluginConfig(pluginName string) (map[string]interface{}, error)
LoadPluginConfig loads configuration for a specific plugin
func (*PluginConfigManager) ReloadAllConfigs ¶
func (pcm *PluginConfigManager) ReloadAllConfigs() error
ReloadAllConfigs reloads all plugin configurations from disk
func (*PluginConfigManager) SavePluginConfig ¶
func (pcm *PluginConfigManager) SavePluginConfig(pluginName string, config map[string]interface{}) error
SavePluginConfig saves configuration for a specific plugin
type PluginError ¶
type PluginError struct {
Code PluginErrorCode `json:"code"`
Message string `json:"message"`
PluginName string `json:"plugin_name,omitempty"`
PluginPath string `json:"plugin_path,omitempty"`
Details map[string]interface{} `json:"details,omitempty"`
Cause error `json:"cause,omitempty"`
Timestamp time.Time `json:"timestamp"`
StackTrace []string `json:"stack_trace,omitempty"`
Suggestions []string `json:"suggestions,omitempty"`
}
PluginError represents a detailed plugin error
func ErrPluginAlreadyExists ¶
func ErrPluginAlreadyExists(name string) *PluginError
func ErrPluginInitError ¶
func ErrPluginInitError(name string, cause error) *PluginError
func ErrPluginLoadError ¶
func ErrPluginLoadError(path string, cause error) *PluginError
func ErrPluginNotFoundError ¶
func ErrPluginNotFoundError(name string) *PluginError
func ErrResourceLimitError ¶
func ErrResourceLimitError(resource string, limit interface{}, actual interface{}) *PluginError
func ErrSecurityViolationError ¶
func ErrSecurityViolationError(operation string, details map[string]interface{}) *PluginError
func NewPluginError ¶
func NewPluginError(code PluginErrorCode, message string) *PluginError
NewPluginError creates a new plugin error
func NewPluginErrorWithCause ¶
func NewPluginErrorWithCause(code PluginErrorCode, message string, cause error) *PluginError
NewPluginErrorWithCause creates a new plugin error with a cause
func (*PluginError) Error ¶
func (pe *PluginError) Error() string
Error implements the error interface
func (*PluginError) GetSeverity ¶
func (pe *PluginError) GetSeverity() string
GetSeverity returns the error severity level
func (*PluginError) IsRetryable ¶
func (pe *PluginError) IsRetryable() bool
IsRetryable returns true if the error might be resolved by retrying
func (*PluginError) Unwrap ¶
func (pe *PluginError) Unwrap() error
Unwrap returns the underlying error
func (*PluginError) WithDetails ¶
func (pe *PluginError) WithDetails(details map[string]interface{}) *PluginError
WithDetails adds additional details to the error
func (*PluginError) WithPlugin ¶
func (pe *PluginError) WithPlugin(name, path string) *PluginError
WithPlugin adds plugin context to the error
func (*PluginError) WithStackTrace ¶
func (pe *PluginError) WithStackTrace() *PluginError
WithStackTrace captures the current stack trace
func (*PluginError) WithSuggestions ¶
func (pe *PluginError) WithSuggestions(suggestions ...string) *PluginError
WithSuggestions adds troubleshooting suggestions
type PluginErrorCode ¶
type PluginErrorCode string
PluginErrorCode represents different types of plugin errors
const ( // Registration errors ErrPluginAlreadyRegistered PluginErrorCode = "PLUGIN_ALREADY_REGISTERED" ErrPluginNotFound PluginErrorCode = "PLUGIN_NOT_FOUND" ErrInvalidPlugin PluginErrorCode = "INVALID_PLUGIN" // Loading errors ErrPluginLoadFailed PluginErrorCode = "PLUGIN_LOAD_FAILED" ErrPluginSymbolNotFound PluginErrorCode = "PLUGIN_SYMBOL_NOT_FOUND" ErrPluginInvalidInterface PluginErrorCode = "PLUGIN_INVALID_INTERFACE" // Execution errors ErrPluginInitFailed PluginErrorCode = "PLUGIN_INIT_FAILED" ErrPluginExecutionFailed PluginErrorCode = "PLUGIN_EXECUTION_FAILED" ErrPluginCloseFailed PluginErrorCode = "PLUGIN_CLOSE_FAILED" // Security errors ErrSecurityViolation PluginErrorCode = "SECURITY_VIOLATION" ErrResourceLimitExceeded PluginErrorCode = "RESOURCE_LIMIT_EXCEEDED" ErrPermissionDenied PluginErrorCode = "PERMISSION_DENIED" // Hook errors ErrHookExecutionFailed PluginErrorCode = "HOOK_EXECUTION_FAILED" ErrHookNotFound PluginErrorCode = "HOOK_NOT_FOUND" // Configuration errors ErrInvalidConfiguration PluginErrorCode = "INVALID_CONFIGURATION" ErrConfigurationMissing PluginErrorCode = "CONFIGURATION_MISSING" // Dependency errors ErrDependencyNotFound PluginErrorCode = "DEPENDENCY_NOT_FOUND" ErrCircularDependency PluginErrorCode = "CIRCULAR_DEPENDENCY" ErrIncompatibleVersion PluginErrorCode = "INCOMPATIBLE_VERSION" )
const ErrPluginInUse PluginErrorCode = "PLUGIN_IN_USE"
PluginInUse error
type PluginFileInfo ¶
type PluginFileInfo struct {
Path string
ModTime time.Time
Size int64
Hash string
PluginName string
Version string
Dependencies []string
}
PluginFileInfo stores information about a plugin file
type PluginHook ¶
type PluginHook func(data interface{}) error
PluginHook represents a hook function
type PluginInfo ¶
type PluginInfo struct {
Path string `json:"path"`
Name string `json:"name"`
Version string `json:"version"`
Type string `json:"type"`
LoadTime time.Time `json:"load_time"`
Size int64 `json:"size"`
Checksum string `json:"checksum"`
Plugin Plugin `json:"-"`
NativePlugin *plugin.Plugin `json:"-"`
}
PluginInfo contains metadata about a loaded plugin
type PluginLoader ¶
type PluginLoader struct {
// contains filtered or unexported fields
}
PluginLoader handles dynamic loading of Go plugins
func NewPluginLoader ¶
func NewPluginLoader(config *LoaderConfig) *PluginLoader
NewPluginLoader creates a new plugin loader with the given configuration
func (*PluginLoader) AddSearchPath ¶
func (pl *PluginLoader) AddSearchPath(path string) error
AddSearchPath adds a new search path
func (*PluginLoader) DiscoverPlugins ¶
func (pl *PluginLoader) DiscoverPlugins() ([]string, error)
DiscoverPlugins discovers all plugins in the search paths
func (*PluginLoader) GetLoadedPlugins ¶
func (pl *PluginLoader) GetLoadedPlugins() map[string]*PluginInfo
GetLoadedPlugins returns information about all loaded plugins
func (*PluginLoader) GetPluginByName ¶
func (pl *PluginLoader) GetPluginByName(name string) (Plugin, error)
GetPluginByName finds a loaded plugin by name
func (*PluginLoader) GetPluginsByType ¶
func (pl *PluginLoader) GetPluginsByType(pluginType string) []Plugin
GetPluginsByType returns all loaded plugins of a specific type
func (*PluginLoader) GetSearchPaths ¶
func (pl *PluginLoader) GetSearchPaths() []string
GetSearchPaths returns the current search paths
func (*PluginLoader) Load ¶
func (pl *PluginLoader) Load(path string) (Plugin, error)
Load loads a plugin from the specified path
func (*PluginLoader) LoadAll ¶
func (pl *PluginLoader) LoadAll() ([]Plugin, []error)
LoadAll loads all discovered plugins
func (*PluginLoader) LoadFromSearchPath ¶
func (pl *PluginLoader) LoadFromSearchPath(filename string) (Plugin, error)
LoadFromSearchPath loads a plugin by searching through configured search paths
func (*PluginLoader) ReloadPlugin ¶
func (pl *PluginLoader) ReloadPlugin(path string) (Plugin, error)
ReloadPlugin reloads a specific plugin
func (*PluginLoader) RemoveSearchPath ¶
func (pl *PluginLoader) RemoveSearchPath(path string)
RemoveSearchPath removes a search path
func (*PluginLoader) UnloadAll ¶
func (pl *PluginLoader) UnloadAll() []error
UnloadAll unloads all loaded plugins
func (*PluginLoader) UnloadPlugin ¶
func (pl *PluginLoader) UnloadPlugin(path string) error
UnloadPlugin unloads a specific plugin
func (*PluginLoader) VerifyPlugin ¶
func (pl *PluginLoader) VerifyPlugin(path string) error
VerifyPlugin verifies a plugin's integrity and compatibility
type PluginManager ¶
type PluginManager struct {
// contains filtered or unexported fields
}
PluginManager manages all registered plugins
func NewPluginManager ¶
func NewPluginManager() *PluginManager
NewPluginManager creates a new plugin manager instance
func (*PluginManager) AddHook ¶
func (pm *PluginManager) AddHook(hookType HookType, hookFunc PluginHook)
AddHook adds a hook function for a specific hook type
func (*PluginManager) ClearErrors ¶
func (pm *PluginManager) ClearErrors()
ClearErrors clears all collected errors
func (*PluginManager) Close ¶
func (pm *PluginManager) Close() error
Close closes all registered plugins
func (*PluginManager) ExecuteHook ¶
func (pm *PluginManager) ExecuteHook(hook HookType, data interface{}) error
ExecuteHook executes all hooks of a given type
func (*PluginManager) Get ¶
func (pm *PluginManager) Get(name string) (Plugin, error)
Get retrieves a plugin by name
func (*PluginManager) GetErrorCollector ¶
func (pm *PluginManager) GetErrorCollector() *ErrorCollector
GetErrorCollector returns the error collector for diagnostics
func (*PluginManager) GetPluginStats ¶
func (pm *PluginManager) GetPluginStats() map[string]interface{}
GetPluginStats returns statistics about loaded plugins
func (*PluginManager) ListPlugins ¶
func (pm *PluginManager) ListPlugins() []string
ListPlugins returns a list of all registered plugin names
func (*PluginManager) LoadFromDirectory ¶
func (pm *PluginManager) LoadFromDirectory(dir string) error
LoadFromDirectory loads all plugins from a directory
func (*PluginManager) Register ¶
func (pm *PluginManager) Register(plugin Plugin) error
Register adds a plugin to the manager
func (*PluginManager) RemoveHooks ¶
func (pm *PluginManager) RemoveHooks(hookType HookType)
RemoveHooks removes all hooks for a specific hook type
func (*PluginManager) SetSecurity ¶
func (pm *PluginManager) SetSecurity(security *PluginSecurity)
SetSecurity updates the security policy for the plugin manager
func (*PluginManager) Unregister ¶
func (pm *PluginManager) Unregister(name string) error
Unregister removes a plugin from the manager
type PluginSecurity ¶
type PluginSecurity struct {
// File system access restrictions
AllowedPaths []string `json:"allowed_paths"`
BlockedPaths []string `json:"blocked_paths"`
ReadOnlyMode bool `json:"read_only_mode"`
// Resource limitations
MaxMemoryUsage int64 `json:"max_memory_mb"` // in MB
MaxExecutionTime time.Duration `json:"max_execution_time"` // per operation
MaxFileSize int64 `json:"max_file_size"` // in bytes
// Network access
NetworkAccess bool `json:"network_access"`
AllowedHosts []string `json:"allowed_hosts,omitempty"`
BlockedHosts []string `json:"blocked_hosts,omitempty"`
// System access
FileSystemAccess bool `json:"file_system_access"`
SystemCalls bool `json:"system_calls"`
EnvironmentAccess bool `json:"environment_access"`
// Plugin-specific
AllowNativeLibs bool `json:"allow_native_libs"`
TrustedSignature bool `json:"trusted_signature"`
CodeSigning bool `json:"code_signing"`
}
PluginSecurity defines security constraints for plugins
func DefaultSecurity ¶
func DefaultSecurity() *PluginSecurity
DefaultSecurity returns a conservative security configuration
func StrictSecurity ¶
func StrictSecurity() *PluginSecurity
StrictSecurity returns a highly restrictive security configuration
type ProtocolPlugin ¶
type ResourceMonitor ¶
type ResourceMonitor struct {
// contains filtered or unexported fields
}
ResourceMonitor monitors plugin resource usage
func NewResourceMonitor ¶
func NewResourceMonitor(maxMemoryMB int64, maxExecTime time.Duration) *ResourceMonitor
NewResourceMonitor creates a new resource monitor
func (*ResourceMonitor) CheckResources ¶
func (rm *ResourceMonitor) CheckResources() error
CheckResources validates current resource usage
type SecurePlugin ¶
type SecurePlugin struct {
Plugin
// contains filtered or unexported fields
}
SecurePlugin wraps a plugin with security constraints
func NewSecurePlugin ¶
func NewSecurePlugin(plugin Plugin, security *PluginSecurity, basePath string) *SecurePlugin
NewSecurePlugin creates a new secure plugin wrapper
func (*SecurePlugin) Close ¶
func (sp *SecurePlugin) Close() error
Close wraps the plugin's Close method with security checks
func (*SecurePlugin) Init ¶
func (sp *SecurePlugin) Init(config map[string]interface{}) error
Init wraps the plugin's Init method with security checks
func (*SecurePlugin) ValidateAccess ¶
func (sp *SecurePlugin) ValidateAccess(operation string, resource string) error
ValidateAccess implements security validation for the wrapped plugin
type SecurePluginExecutor ¶
type SecurePluginExecutor struct {
// contains filtered or unexported fields
}
SecurePluginExecutor wraps plugin execution with security checks
func NewSecurePluginExecutor ¶
func NewSecurePluginExecutor(plugin Plugin, security *PluginSecurity, basePath string) *SecurePluginExecutor
NewSecurePluginExecutor creates a secure plugin executor
func (*SecurePluginExecutor) Execute ¶
func (spe *SecurePluginExecutor) Execute(ctx context.Context, method string, args ...interface{}) (interface{}, error)
Execute executes a plugin method with security checks
func (*SecurePluginExecutor) GetMonitor ¶
func (spe *SecurePluginExecutor) GetMonitor() *ResourceMonitor
GetMonitor returns the resource monitor
func (*SecurePluginExecutor) GetValidator ¶
func (spe *SecurePluginExecutor) GetValidator() *SecurityValidator
GetValidator returns the security validator
type SecurityValidator ¶
type SecurityValidator struct {
// contains filtered or unexported fields
}
SecurityValidator validates plugin operations against security policies
func NewSecurityValidator ¶
func NewSecurityValidator(policy *PluginSecurity, basePath string) *SecurityValidator
NewSecurityValidator creates a new security validator
func (*SecurityValidator) ValidateFileOperation ¶
func (sv *SecurityValidator) ValidateFileOperation(operation string, path string) error
ValidateFileOperation validates file operations
func (*SecurityValidator) ValidateFilePath ¶
func (sv *SecurityValidator) ValidateFilePath(path string) error
ValidateFilePath validates if a file path is allowed
func (*SecurityValidator) ValidateFileSize ¶
func (sv *SecurityValidator) ValidateFileSize(size int64) error
ValidateFileSize validates file size against policy
func (*SecurityValidator) ValidateNetworkAccess ¶
func (sv *SecurityValidator) ValidateNetworkAccess(host string) error
ValidateNetworkAccess validates network operations
type StoragePlugin ¶
type TransformPlugin ¶
type Version ¶
type Version struct {
Major int `json:"major"`
Minor int `json:"minor"`
Patch int `json:"patch"`
PreRelease string `json:"pre_release,omitempty"`
BuildMetadata string `json:"build_metadata,omitempty"`
}
Version represents a semantic version for plugins
func ParseVersion ¶
ParseVersion parses a semantic version string
type VersionedPlugin ¶
type VersionedPlugin struct {
Plugin
// contains filtered or unexported fields
}
VersionedPlugin extends the Plugin interface with version management
func NewVersionedPlugin ¶
func NewVersionedPlugin(plugin Plugin, version string) (*VersionedPlugin, error)
NewVersionedPlugin creates a new versioned plugin wrapper
func (*VersionedPlugin) AddDependency ¶
func (vp *VersionedPlugin) AddDependency(pluginName string, versionRequirement string)
AddDependency adds a dependency requirement
func (*VersionedPlugin) CheckDependencies ¶
func (vp *VersionedPlugin) CheckDependencies(availablePlugins map[string]*Version) error
CheckDependencies verifies all dependencies are satisfied
func (*VersionedPlugin) GetDependencies ¶
func (vp *VersionedPlugin) GetDependencies() map[string]string
GetDependencies returns all dependencies
func (*VersionedPlugin) GetVersion ¶
func (vp *VersionedPlugin) GetVersion() *Version
GetVersion returns the plugin version