Documentation
¶
Overview ¶
Package plugins provides plugin execution with progress reporting and error handling.
Package plugins provides WebSocket streaming for plugin execution.
Package plugins provides modular network diagnostic plugins for NetScout-Go
Index ¶
- Constants
- func LoadPluginFunc(pluginDir, pluginID string) (func(map[string]interface{}) (interface{}, error), error)
- type BulkInstallResponse
- type BulkInstallResult
- type Command
- type ConfigManager
- func (cm *ConfigManager) AddGitHubToken(name, token, organization string) error
- func (cm *ConfigManager) AddSource(name, organization, pattern string, isDefault bool) error
- func (cm *ConfigManager) GetConfiguration() *Configuration
- func (cm *ConfigManager) GetGitHubToken(name string) (GitHubToken, error)
- func (cm *ConfigManager) GetGitHubTokens() []GitHubToken
- func (cm *ConfigManager) GetSources() []PluginSource
- func (cm *ConfigManager) GetTokenForOrganization(org string) (string, error)
- func (cm *ConfigManager) LoadConfiguration() error
- func (cm *ConfigManager) RemoveGitHubToken(name string) error
- func (cm *ConfigManager) RemoveSource(name string) error
- func (cm *ConfigManager) SaveConfiguration() error
- func (cm *ConfigManager) SetLoadedCallback(callback func())
- type Configuration
- type Dependency
- type DynamicPlugin
- type ExecutionContext
- func (ec *ExecutionContext) AddProgressListener(listener ProgressListener)
- func (ec *ExecutionContext) Cancel()
- func (ec *ExecutionContext) Context() context.Context
- func (ec *ExecutionContext) GetResult() *ExecutionResult
- func (ec *ExecutionContext) UpdateProgress(current, total int, message string)
- type ExecutionProgress
- type ExecutionResult
- type ExecutionStatus
- type ExecutionStreamClient
- func (c *ExecutionStreamClient) IsSubscribed(executionID string) bool
- func (c *ExecutionStreamClient) Send(msg StreamMessage) error
- func (c *ExecutionStreamClient) Subscribe(executionID string)
- func (c *ExecutionStreamClient) SubscribeAll()
- func (c *ExecutionStreamClient) Unsubscribe(executionID string)
- type ExecutionStreamManager
- func (m *ExecutionStreamManager) Broadcast(executionID string, msg StreamMessage)
- func (m *ExecutionStreamManager) CreateProgressListener(executionID string) ProgressListener
- func (m *ExecutionStreamManager) ExecuteWithStreaming(pluginID string, params map[string]interface{}, ...) (*ExecutionContext, error)
- func (m *ExecutionStreamManager) HandleClientMessage(client *ExecutionStreamClient, rawMsg []byte)
- func (m *ExecutionStreamManager) RegisterClient(conn *websocket.Conn) *ExecutionStreamClient
- func (m *ExecutionStreamManager) UnregisterClient(client *ExecutionStreamClient)
- type GitHubConfig
- type GitHubRepository
- type GitHubToken
- type GitVersionInfo
- type Option
- type Parameter
- type ParameterType
- type Plugin
- type PluginCatalog
- type PluginCatalogCache
- type PluginDataJSON
- type PluginExecutor
- func (pe *PluginExecutor) CancelExecution(executionID string) error
- func (pe *PluginExecutor) CleanupOldExecutions(maxAge time.Duration) int
- func (pe *PluginExecutor) Execute(pluginID string, params map[string]interface{}, ...) *ExecutionContext
- func (pe *PluginExecutor) ExecuteSync(pluginID string, params map[string]interface{}) (*ExecutionResult, error)
- func (pe *PluginExecutor) GetActiveExecutions() []*ExecutionResult
- func (pe *PluginExecutor) GetExecution(executionID string) *ExecutionContext
- type PluginInstaller
- func (pi *PluginInstaller) AddPluginSource(name, organization, pattern string) error
- func (pi *PluginInstaller) BulkInstallPlugins(repositories []string) BulkInstallResponse
- func (pi *PluginInstaller) CheckForUpdates(pluginID string) (bool, string)
- func (pi *PluginInstaller) GetPluginDetails(pluginID string) (PluginMetadata, error)
- func (pi *PluginInstaller) GetPluginSources() []PluginSource
- func (pi *PluginInstaller) InstallFromGitHub(org string, repo string, branch string) (PluginMetadata, error)
- func (pi *PluginInstaller) InstallPlugin(url string) (PluginMetadata, error)
- func (pi *PluginInstaller) InstallPluginFromRepository(repository string) error
- func (pi *PluginInstaller) ListAllGitHubPlugins() ([]map[string]interface{}, error)
- func (pi *PluginInstaller) ListAvailablePlugins() ([]PluginListItem, error)
- func (pi *PluginInstaller) ListAvailablePluginsWithMeta(forceRefresh bool) (*PluginListResponse, error)
- func (pi *PluginInstaller) ListGitHubPlugins(org string) ([]map[string]interface{}, error)
- func (pi *PluginInstaller) ListInstalledPlugins() ([]PluginMetadata, error)
- func (pi *PluginInstaller) RefreshPluginCatalog() (*PluginListResponse, error)
- func (pi *PluginInstaller) RemovePluginSource(organization string) error
- func (pi *PluginInstaller) UninstallPlugin(pluginID string) (PluginMetadata, error)
- func (pi *PluginInstaller) UpdatePlugin(pluginID string) (PluginMetadata, error)
- func (pi *PluginInstaller) UpdateVersionInfo(pluginID string) error
- func (pi *PluginInstaller) UploadPlugin(file io.Reader) (PluginMetadata, error)
- type PluginListItem
- type PluginListResponse
- type PluginLoader
- type PluginManager
- func (pm *PluginManager) GetPlugin(id string) (*Plugin, error)
- func (pm *PluginManager) GetPlugins() []*Plugin
- func (pm *PluginManager) RefreshPlugins() error
- func (pm *PluginManager) RegisterPlugin(plugin *Plugin)
- func (pm *PluginManager) RegisterPlugins() error
- func (pm *PluginManager) RunPlugin(id string, params map[string]interface{}) (interface{}, error)
- type PluginMetadata
- type PluginRegistry
- type PluginSource
- type ProgressListener
- type StreamMessage
Constants ¶
const ( // Execution lifecycle messages MsgTypeExecutionStarted = "execution_started" MsgTypeExecutionProgress = "execution_progress" MsgTypeExecutionCompleted = "execution_completed" MsgTypeExecutionFailed = "execution_failed" MsgTypeExecutionCancelled = "execution_cancelled" // Request messages from client MsgTypeCancelExecution = "cancel_execution" MsgTypeGetExecutionStatus = "get_execution_status" MsgTypeSubscribe = "subscribe" MsgTypeUnsubscribe = "unsubscribe" )
MessageType constants for WebSocket messages.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BulkInstallResponse ¶
type BulkInstallResponse struct {
Results []BulkInstallResult `json:"results"`
TotalPlugins int `json:"totalPlugins"`
SuccessCount int `json:"successCount"`
FailureCount int `json:"failureCount"`
OverallSuccess bool `json:"overallSuccess"`
}
BulkInstallResponse represents the response from bulk installation
type BulkInstallResult ¶
type BulkInstallResult struct {
PluginID string `json:"pluginId"`
Plugin PluginMetadata `json:"plugin,omitempty"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
BulkInstallResult represents the result of a bulk installation
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command represents a shell command
func NewCommandWithArgs ¶
NewCommandWithArgs creates a new command with arguments
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
ConfigManager handles loading and saving plugin system configuration
func NewConfigManager ¶
func NewConfigManager(configPath string) *ConfigManager
NewConfigManager creates a new configuration manager
func (*ConfigManager) AddGitHubToken ¶
func (cm *ConfigManager) AddGitHubToken(name, token, organization string) error
AddGitHubToken adds a GitHub token to the configuration
func (*ConfigManager) AddSource ¶
func (cm *ConfigManager) AddSource(name, organization, pattern string, isDefault bool) error
AddSource adds a plugin source to the configuration
func (*ConfigManager) GetConfiguration ¶
func (cm *ConfigManager) GetConfiguration() *Configuration
GetConfiguration returns the current configuration
func (*ConfigManager) GetGitHubToken ¶
func (cm *ConfigManager) GetGitHubToken(name string) (GitHubToken, error)
GetGitHubToken returns the GitHub token for the specified name
func (*ConfigManager) GetGitHubTokens ¶
func (cm *ConfigManager) GetGitHubTokens() []GitHubToken
GetGitHubTokens returns all GitHub tokens
func (*ConfigManager) GetSources ¶
func (cm *ConfigManager) GetSources() []PluginSource
GetSources returns all plugin sources
func (*ConfigManager) GetTokenForOrganization ¶
func (cm *ConfigManager) GetTokenForOrganization(org string) (string, error)
GetTokenForOrganization returns a GitHub token for the specified organization
func (*ConfigManager) LoadConfiguration ¶
func (cm *ConfigManager) LoadConfiguration() error
LoadConfiguration loads the configuration from the config file
func (*ConfigManager) RemoveGitHubToken ¶
func (cm *ConfigManager) RemoveGitHubToken(name string) error
RemoveGitHubToken removes a GitHub token from the configuration
func (*ConfigManager) RemoveSource ¶
func (cm *ConfigManager) RemoveSource(name string) error
RemoveSource removes a plugin source from the configuration
func (*ConfigManager) SaveConfiguration ¶
func (cm *ConfigManager) SaveConfiguration() error
SaveConfiguration saves the configuration to the config file
func (*ConfigManager) SetLoadedCallback ¶
func (cm *ConfigManager) SetLoadedCallback(callback func())
SetLoadedCallback sets a callback function to be called when the configuration is loaded
type Configuration ¶
type Configuration struct {
GitHub GitHubConfig `json:"github"`
Sources []PluginSource `json:"sources"`
}
Configuration represents the main configuration structure
type Dependency ¶
Dependency represents a plugin dependency
type DynamicPlugin ¶
type DynamicPlugin struct {
// contains filtered or unexported fields
}
DynamicPlugin represents a plugin that is executed dynamically
func (*DynamicPlugin) Execute ¶
func (p *DynamicPlugin) Execute(params map[string]interface{}) (interface{}, error)
Execute runs the plugin with the given parameters
func (*DynamicPlugin) GetDefinition ¶
func (p *DynamicPlugin) GetDefinition() types.PluginDefinition
GetDefinition returns the plugin definition
func (*DynamicPlugin) IsIterable ¶
func (p *DynamicPlugin) IsIterable() bool
IsIterable checks if the plugin implements the IterablePlugin interface
type ExecutionContext ¶
type ExecutionContext struct {
ID string
PluginID string
Params map[string]interface{}
Config *types.PluginExecutionConfig
// contains filtered or unexported fields
}
ExecutionContext provides context for a plugin execution.
func NewExecutionContext ¶
func NewExecutionContext(pluginID string, params map[string]interface{}, config *types.PluginExecutionConfig) *ExecutionContext
NewExecutionContext creates a new execution context.
func (*ExecutionContext) AddProgressListener ¶
func (ec *ExecutionContext) AddProgressListener(listener ProgressListener)
AddProgressListener adds a listener for progress updates.
func (*ExecutionContext) Cancel ¶
func (ec *ExecutionContext) Cancel()
Cancel cancels the execution.
func (*ExecutionContext) Context ¶
func (ec *ExecutionContext) Context() context.Context
Context returns the context for cancellation support.
func (*ExecutionContext) GetResult ¶
func (ec *ExecutionContext) GetResult() *ExecutionResult
GetResult returns the current execution result.
func (*ExecutionContext) UpdateProgress ¶
func (ec *ExecutionContext) UpdateProgress(current, total int, message string)
UpdateProgress updates the execution progress.
type ExecutionProgress ¶
type ExecutionProgress struct {
Current int `json:"current"`
Total int `json:"total"`
Message string `json:"message"`
}
ExecutionProgress represents the progress of a plugin execution.
type ExecutionResult ¶
type ExecutionResult struct {
ID string `json:"id"`
PluginID string `json:"pluginId"`
Status ExecutionStatus `json:"status"`
Progress *ExecutionProgress `json:"progress,omitempty"`
Result interface{} `json:"result,omitempty"`
Error string `json:"error,omitempty"`
StartTime time.Time `json:"startTime"`
EndTime *time.Time `json:"endTime,omitempty"`
Duration int64 `json:"duration"` // in milliseconds
Params map[string]interface{} `json:"params"`
}
ExecutionResult represents the result of a plugin execution.
type ExecutionStatus ¶
type ExecutionStatus string
ExecutionStatus represents the status of a plugin execution.
const ( StatusPending ExecutionStatus = "pending" StatusRunning ExecutionStatus = "running" StatusCompleted ExecutionStatus = "completed" StatusFailed ExecutionStatus = "failed" StatusCancelled ExecutionStatus = "cancelled" )
type ExecutionStreamClient ¶
type ExecutionStreamClient struct {
// contains filtered or unexported fields
}
ExecutionStreamClient represents a WebSocket client for plugin streaming.
func NewExecutionStreamClient ¶
func NewExecutionStreamClient(conn *websocket.Conn) *ExecutionStreamClient
NewExecutionStreamClient creates a new streaming client.
func (*ExecutionStreamClient) IsSubscribed ¶
func (c *ExecutionStreamClient) IsSubscribed(executionID string) bool
IsSubscribed checks if client is subscribed to an execution.
func (*ExecutionStreamClient) Send ¶
func (c *ExecutionStreamClient) Send(msg StreamMessage) error
Send sends a message to the client.
func (*ExecutionStreamClient) Subscribe ¶
func (c *ExecutionStreamClient) Subscribe(executionID string)
Subscribe subscribes to an execution.
func (*ExecutionStreamClient) SubscribeAll ¶
func (c *ExecutionStreamClient) SubscribeAll()
SubscribeAll subscribes to all executions.
func (*ExecutionStreamClient) Unsubscribe ¶
func (c *ExecutionStreamClient) Unsubscribe(executionID string)
Unsubscribe unsubscribes from an execution.
type ExecutionStreamManager ¶
type ExecutionStreamManager struct {
// contains filtered or unexported fields
}
ExecutionStreamManager manages WebSocket clients for execution streaming.
func NewExecutionStreamManager ¶
func NewExecutionStreamManager(executor *PluginExecutor) *ExecutionStreamManager
NewExecutionStreamManager creates a new stream manager.
func (*ExecutionStreamManager) Broadcast ¶
func (m *ExecutionStreamManager) Broadcast(executionID string, msg StreamMessage)
Broadcast sends a message to all subscribed clients.
func (*ExecutionStreamManager) CreateProgressListener ¶
func (m *ExecutionStreamManager) CreateProgressListener(executionID string) ProgressListener
CreateProgressListener creates a progress listener for an execution.
func (*ExecutionStreamManager) ExecuteWithStreaming ¶
func (m *ExecutionStreamManager) ExecuteWithStreaming(pluginID string, params map[string]interface{}, config *types.PluginExecutionConfig) (*ExecutionContext, error)
ExecuteWithStreaming executes a plugin with streaming progress updates.
func (*ExecutionStreamManager) HandleClientMessage ¶
func (m *ExecutionStreamManager) HandleClientMessage(client *ExecutionStreamClient, rawMsg []byte)
HandleClientMessage processes incoming messages from a client.
func (*ExecutionStreamManager) RegisterClient ¶
func (m *ExecutionStreamManager) RegisterClient(conn *websocket.Conn) *ExecutionStreamClient
RegisterClient registers a new WebSocket client.
func (*ExecutionStreamManager) UnregisterClient ¶
func (m *ExecutionStreamManager) UnregisterClient(client *ExecutionStreamClient)
UnregisterClient removes a WebSocket client.
type GitHubConfig ¶
type GitHubConfig struct {
Tokens []GitHubToken `json:"tokens"`
}
GitHubConfig represents GitHub-specific configuration
type GitHubRepository ¶
type GitHubRepository struct {
Name string `json:"name"`
FullName string `json:"full_name"`
Description string `json:"description"`
HTMLURL string `json:"html_url"`
CloneURL string `json:"clone_url"`
UpdatedAt string `json:"updated_at"`
}
GitHubRepository represents a GitHub repository from the API
type GitHubToken ¶
type GitHubToken struct {
Name string `json:"name"`
Token string `json:"token"`
Organization string `json:"organization"`
}
GitHubToken represents a GitHub personal access token
type GitVersionInfo ¶
type GitVersionInfo struct {
CommitID string `json:"commitID"`
Branch string `json:"branch"`
LatestCommitID string `json:"latestCommitID,omitempty"`
Repository string `json:"repository,omitempty"`
Organization string `json:"organization,omitempty"`
}
GitVersionInfo represents Git version information for a plugin
type Option ¶
type Option struct {
Value interface{} `json:"value"`
Label string `json:"label"`
}
Option defines an option for a select parameter
type Parameter ¶
type Parameter struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Type ParameterType `json:"type"`
Required bool `json:"required"`
Default interface{} `json:"default,omitempty"`
Options []Option `json:"options,omitempty"` // For select type
Min *float64 `json:"min,omitempty"` // For number/range type
Max *float64 `json:"max,omitempty"` // For number/range type
Step *float64 `json:"step,omitempty"` // For number/range type
CanIterate bool `json:"canIterate,omitempty"` // Whether this parameter supports iteration
}
Parameter defines a plugin parameter
type ParameterType ¶
type ParameterType string
ParameterType defines the type of a plugin parameter
const ( // TypeString is the string type identifier. TypeString ParameterType = "string" // TypeNumber is the number type identifier. TypeNumber ParameterType = "number" // TypeBoolean is the boolean type identifier. TypeBoolean ParameterType = "boolean" // TypeSelect is the select type identifier. TypeSelect ParameterType = "select" // TypeRange is the range type identifier. TypeRange ParameterType = "range" )
type Plugin ¶
type Plugin struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Version string `json:"version"`
Author string `json:"author"`
License string `json:"license"`
Icon string `json:"icon"`
Parameters []Parameter `json:"parameters"`
Execute func(map[string]interface{}) (interface{}, error) `json:"-"`
}
Plugin represents a NetTool plugin
type PluginCatalog ¶
type PluginCatalog struct {
Plugins []PluginListItem `json:"plugins"`
}
PluginCatalog represents the catalog of available plugins
type PluginCatalogCache ¶
type PluginCatalogCache struct {
Plugins []PluginListItem `json:"plugins"`
LastUpdated int64 `json:"lastUpdated"` // Unix timestamp
Source string `json:"source"` // Source organization
}
PluginCatalogCache represents the cached plugin catalog with timestamp
type PluginDataJSON ¶
type PluginDataJSON struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Version string `json:"version"`
Author string `json:"author"`
License string `json:"license"`
Category string `json:"category"`
Icon string `json:"icon"`
Screenshots []string `json:"screenshots"`
Requirements []string `json:"requirements"`
Tags []string `json:"tags"`
MinVersion string `json:"minVersion"`
Homepage string `json:"homepage"`
}
PluginDataJSON represents the data.json structure in plugin repositories
type PluginExecutor ¶
type PluginExecutor struct {
// contains filtered or unexported fields
}
PluginExecutor handles enhanced plugin execution.
func NewPluginExecutor ¶
func NewPluginExecutor(manager *PluginManager) *PluginExecutor
NewPluginExecutor creates a new plugin executor.
func (*PluginExecutor) CancelExecution ¶
func (pe *PluginExecutor) CancelExecution(executionID string) error
CancelExecution cancels an execution by ID.
func (*PluginExecutor) CleanupOldExecutions ¶
func (pe *PluginExecutor) CleanupOldExecutions(maxAge time.Duration) int
CleanupOldExecutions removes old completed executions.
func (*PluginExecutor) Execute ¶
func (pe *PluginExecutor) Execute(pluginID string, params map[string]interface{}, config *types.PluginExecutionConfig) *ExecutionContext
Execute runs a plugin with enhanced execution context.
func (*PluginExecutor) ExecuteSync ¶
func (pe *PluginExecutor) ExecuteSync(pluginID string, params map[string]interface{}) (*ExecutionResult, error)
ExecuteSync runs a plugin synchronously with enhanced error handling.
func (*PluginExecutor) GetActiveExecutions ¶
func (pe *PluginExecutor) GetActiveExecutions() []*ExecutionResult
GetActiveExecutions returns all active executions.
func (*PluginExecutor) GetExecution ¶
func (pe *PluginExecutor) GetExecution(executionID string) *ExecutionContext
GetExecution returns an execution context by ID.
type PluginInstaller ¶
type PluginInstaller struct {
// contains filtered or unexported fields
}
PluginInstaller handles installation, updates and uninstallation of plugins
func NewPluginInstaller ¶
func NewPluginInstaller(pluginsDir string, manager *PluginManager) *PluginInstaller
NewPluginInstaller creates a new plugin installer
func (*PluginInstaller) AddPluginSource ¶
func (pi *PluginInstaller) AddPluginSource(name, organization, pattern string) error
AddPluginSource adds a new plugin source organization
func (*PluginInstaller) BulkInstallPlugins ¶
func (pi *PluginInstaller) BulkInstallPlugins(repositories []string) BulkInstallResponse
BulkInstallPlugins installs multiple plugins from a list of repositories
func (*PluginInstaller) CheckForUpdates ¶
func (pi *PluginInstaller) CheckForUpdates(pluginID string) (bool, string)
CheckForUpdates checks if a plugin has updates available (exported version of checkForUpdates)
func (*PluginInstaller) GetPluginDetails ¶
func (pi *PluginInstaller) GetPluginDetails(pluginID string) (PluginMetadata, error)
GetPluginDetails returns detailed information about a plugin
func (*PluginInstaller) GetPluginSources ¶
func (pi *PluginInstaller) GetPluginSources() []PluginSource
GetPluginSources returns the list of plugin sources
func (*PluginInstaller) InstallFromGitHub ¶
func (pi *PluginInstaller) InstallFromGitHub(org string, repo string, branch string) (PluginMetadata, error)
InstallFromGitHub installs a plugin from a GitHub repository in the specified organization
func (*PluginInstaller) InstallPlugin ¶
func (pi *PluginInstaller) InstallPlugin(url string) (PluginMetadata, error)
InstallPlugin installs a plugin from a URL or Git repository
func (*PluginInstaller) InstallPluginFromRepository ¶
func (pi *PluginInstaller) InstallPluginFromRepository(repository string) error
InstallPluginFromRepository installs a plugin from a GitHub repository
func (*PluginInstaller) ListAllGitHubPlugins ¶
func (pi *PluginInstaller) ListAllGitHubPlugins() ([]map[string]interface{}, error)
ListAllGitHubPlugins lists available plugins from all registered organizations
func (*PluginInstaller) ListAvailablePlugins ¶
func (pi *PluginInstaller) ListAvailablePlugins() ([]PluginListItem, error)
ListAvailablePlugins returns a list of available plugins from cache or GitHub
func (*PluginInstaller) ListAvailablePluginsWithMeta ¶
func (pi *PluginInstaller) ListAvailablePluginsWithMeta(forceRefresh bool) (*PluginListResponse, error)
ListAvailablePluginsWithMeta returns plugins with metadata about cache status
func (*PluginInstaller) ListGitHubPlugins ¶
func (pi *PluginInstaller) ListGitHubPlugins(org string) ([]map[string]interface{}, error)
ListGitHubPlugins lists available plugins from a GitHub organization
func (*PluginInstaller) ListInstalledPlugins ¶
func (pi *PluginInstaller) ListInstalledPlugins() ([]PluginMetadata, error)
ListInstalledPlugins returns a list of installed plugins with metadata
func (*PluginInstaller) RefreshPluginCatalog ¶
func (pi *PluginInstaller) RefreshPluginCatalog() (*PluginListResponse, error)
RefreshPluginCatalog forces a refresh of the plugin catalog from GitHub
func (*PluginInstaller) RemovePluginSource ¶
func (pi *PluginInstaller) RemovePluginSource(organization string) error
RemovePluginSource removes a plugin source organization
func (*PluginInstaller) UninstallPlugin ¶
func (pi *PluginInstaller) UninstallPlugin(pluginID string) (PluginMetadata, error)
UninstallPlugin uninstalls a plugin
func (*PluginInstaller) UpdatePlugin ¶
func (pi *PluginInstaller) UpdatePlugin(pluginID string) (PluginMetadata, error)
UpdatePlugin updates a plugin to the latest version
func (*PluginInstaller) UpdateVersionInfo ¶
func (pi *PluginInstaller) UpdateVersionInfo(pluginID string) error
UpdateVersionInfo updates the plugin.json file with the latest version information
func (*PluginInstaller) UploadPlugin ¶
func (pi *PluginInstaller) UploadPlugin(file io.Reader) (PluginMetadata, error)
UploadPlugin installs a plugin from an uploaded ZIP file
type PluginListItem ¶
type PluginListItem struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Version string `json:"version"`
Author string `json:"author"`
License string `json:"license"`
Category string `json:"category"`
Repository string `json:"repository"`
Icon string `json:"icon"`
Installed bool `json:"installed"`
DataJSON map[string]interface{} `json:"dataJson,omitempty"`
Screenshots []string `json:"screenshots,omitempty"`
Requirements []string `json:"requirements,omitempty"`
Tags []string `json:"tags,omitempty"`
}
PluginListItem represents a plugin in the store listing
type PluginListResponse ¶
type PluginListResponse struct {
Plugins []PluginListItem `json:"plugins"`
LastUpdated int64 `json:"lastUpdated"`
FromCache bool `json:"fromCache"`
}
PluginListResponse represents the response for listing available plugins
type PluginLoader ¶
type PluginLoader struct {
// contains filtered or unexported fields
}
PluginLoader handles loading plugins from the filesystem
func NewPluginLoader ¶
func NewPluginLoader(pluginsDir string) *PluginLoader
NewPluginLoader creates a new plugin loader
func (*PluginLoader) GetPluginExecuteFunc ¶
func (p *PluginLoader) GetPluginExecuteFunc(pluginID string) (func(map[string]interface{}) (interface{}, error), error)
GetPluginExecuteFunc returns the Execute function for a plugin
func (*PluginLoader) LoadPlugins ¶
func (p *PluginLoader) LoadPlugins() ([]types.Plugin, error)
LoadPlugins loads all plugins from the plugins directory
type PluginManager ¶
type PluginManager struct {
// contains filtered or unexported fields
}
PluginManager manages the plugins in NetTool
func NewPluginManager ¶
func NewPluginManager() *PluginManager
NewPluginManager creates a new plugin manager
func (*PluginManager) GetPlugin ¶
func (pm *PluginManager) GetPlugin(id string) (*Plugin, error)
GetPlugin returns a plugin by ID
func (*PluginManager) GetPlugins ¶
func (pm *PluginManager) GetPlugins() []*Plugin
GetPlugins returns all registered plugins
func (*PluginManager) RefreshPlugins ¶
func (pm *PluginManager) RefreshPlugins() error
RefreshPlugins refreshes the list of plugins from the plugins directory
func (*PluginManager) RegisterPlugin ¶
func (pm *PluginManager) RegisterPlugin(plugin *Plugin)
RegisterPlugin registers a new plugin
func (*PluginManager) RegisterPlugins ¶
func (pm *PluginManager) RegisterPlugins() error
RegisterPlugins refreshes and registers all plugins This is an alias for RefreshPlugins to maintain API compatibility with plugin_installer.go
type PluginMetadata ¶
type PluginMetadata struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Version string `json:"version"`
Author string `json:"author"`
License string `json:"license"`
Icon string `json:"icon"`
Status string `json:"status"`
UpdateAvailable bool `json:"updateAvailable"`
LatestVersion string `json:"latestVersion,omitempty"`
Path string `json:"path,omitempty"`
Dependencies []Dependency `json:"dependencies,omitempty"`
GitInfo GitVersionInfo `json:"gitInfo,omitempty"`
}
PluginMetadata represents the metadata of a plugin
type PluginRegistry ¶
type PluginRegistry struct {
// contains filtered or unexported fields
}
PluginRegistry is a simple registry for plugin execution functions
func GetRegistry ¶
func GetRegistry() *PluginRegistry
GetRegistry returns the global plugin registry
func NewPluginRegistry ¶
func NewPluginRegistry() *PluginRegistry
NewPluginRegistry creates a new plugin registry
func (*PluginRegistry) GetPluginFunc ¶
func (r *PluginRegistry) GetPluginFunc(id string) (func(map[string]interface{}) (interface{}, error), error)
GetPluginFunc returns a plugin execution function
func (*PluginRegistry) RegisterPluginFunc ¶
func (r *PluginRegistry) RegisterPluginFunc(id string, fn func(map[string]interface{}) (interface{}, error))
RegisterPluginFunc registers a plugin execution function
type PluginSource ¶
type PluginSource struct {
Name string `json:"name"`
Organization string `json:"organization"`
IsDefault bool `json:"isDefault"`
Pattern string `json:"pattern"` // Naming pattern for plugins (e.g., "Plugin_*" or "plugin-*")
}
PluginSource represents a source for plugins
type ProgressListener ¶
type ProgressListener func(result *ExecutionResult)
ProgressListener is called when execution progress updates.
type StreamMessage ¶
type StreamMessage struct {
Type string `json:"type"`
ExecutionID string `json:"executionId,omitempty"`
PluginID string `json:"pluginId,omitempty"`
Data interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
StreamMessage represents a WebSocket message for plugin execution.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cli provides command-line interface functionality for iterable plugins.
|
Package cli provides command-line interface functionality for iterable plugins. |
|
Package types provides type definitions and compatibility helpers for plugins.
|
Package types provides type definitions and compatibility helpers for plugins. |