Documentation
¶
Overview ¶
Package client provides Hockeypuck integration for gRPC plugins
Package client provides gRPC client for communicating with plugins from Hockeypuck ¶
Package client provides a simple adapter for easy Hockeypuck integration
Index ¶
- type HockeypuckPluginHost
- func (h *HockeypuckPluginHost) CheckRateLimit(remoteAddr, operation string) (allowed bool, retryAfter int, reason string)
- func (h *HockeypuckPluginHost) GetHTTPMiddleware() func(http.Handler) http.Handler
- func (h *HockeypuckPluginHost) GetPluginHealth() map[string]interface{}
- func (h *HockeypuckPluginHost) GetPluginStatus() map[string]interface{}
- func (h *HockeypuckPluginHost) HandlePluginManagementEndpoint(w http.ResponseWriter, r *http.Request)
- func (h *HockeypuckPluginHost) Initialize(ctx context.Context) error
- func (h *HockeypuckPluginHost) NotifyKeyChange(change hkpstorage.KeyChange) error
- func (h *HockeypuckPluginHost) ReportSuspiciousActivity(remoteAddr, description string, severity string) error
- func (h *HockeypuckPluginHost) RestartPlugin(pluginName string) error
- func (h *HockeypuckPluginHost) Shutdown(ctx context.Context) error
- type PluginClient
- func (pc *PluginClient) CheckRateLimit(identifier, action string, metadata map[string]string) (*proto.RateLimitResponse, error)
- func (pc *PluginClient) Close() error
- func (pc *PluginClient) ConnectToPlugin(pluginName string) error
- func (pc *PluginClient) ConnectToPlugins() error
- func (pc *PluginClient) DisconnectFromPlugin(pluginName string) error
- func (pc *PluginClient) GetConnectedPlugins() []string
- func (pc *PluginClient) GetPluginHealth() map[string]*proto.HealthStatus
- func (pc *PluginClient) HTTPRequestMiddleware(next http.Handler) http.Handler
- func (pc *PluginClient) HealthCheck(ctx context.Context) error
- func (pc *PluginClient) NotifyKeyChange(changeType proto.KeyChangeEvent_ChangeType, fingerprint string, keyData []byte) error
- func (pc *PluginClient) QueryStorage(queryType proto.StorageQuery_QueryType, query string, ...) (*proto.StorageResponse, error)
- func (pc *PluginClient) ReportThreat(threatLevel proto.ThreatInfo_ThreatLevel, ...) error
- type SimplePluginAdapter
- func (s *SimplePluginAdapter) CheckRateLimit(remoteAddr, operation string) (allowed bool, retryAfter int, reason string)
- func (s *SimplePluginAdapter) GetHealth() map[string]interface{}
- func (s *SimplePluginAdapter) GetStatus() map[string]interface{}
- func (s *SimplePluginAdapter) HTTPMiddleware() func(http.Handler) http.Handler
- func (s *SimplePluginAdapter) HandleManagement(w http.ResponseWriter, r *http.Request)
- func (s *SimplePluginAdapter) OnKeyChange(change hkpstorage.KeyChange) error
- func (s *SimplePluginAdapter) ReportSuspiciousActivity(remoteAddr, description string, severity string) error
- func (s *SimplePluginAdapter) Start(ctx context.Context) error
- func (s *SimplePluginAdapter) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HockeypuckPluginHost ¶
type HockeypuckPluginHost struct {
// contains filtered or unexported fields
}
HockeypuckPluginHost provides the integration between Hockeypuck and gRPC plugins
func NewHockeypuckPluginHost ¶
func NewHockeypuckPluginHost(settings *config.Settings, logger *logrus.Logger) *HockeypuckPluginHost
NewHockeypuckPluginHost creates a new Hockeypuck plugin host
func (*HockeypuckPluginHost) CheckRateLimit ¶
func (h *HockeypuckPluginHost) CheckRateLimit(remoteAddr, operation string) (allowed bool, retryAfter int, reason string)
CheckRateLimit checks if a request should be rate limited
func (*HockeypuckPluginHost) GetHTTPMiddleware ¶
func (h *HockeypuckPluginHost) GetHTTPMiddleware() func(http.Handler) http.Handler
GetHTTPMiddleware returns HTTP middleware for plugin integration
func (*HockeypuckPluginHost) GetPluginHealth ¶
func (h *HockeypuckPluginHost) GetPluginHealth() map[string]interface{}
GetPluginHealth returns health status of all plugins from the health monitor
func (*HockeypuckPluginHost) GetPluginStatus ¶
func (h *HockeypuckPluginHost) GetPluginStatus() map[string]interface{}
GetPluginStatus returns status of all plugins for monitoring/admin endpoints
func (*HockeypuckPluginHost) HandlePluginManagementEndpoint ¶
func (h *HockeypuckPluginHost) HandlePluginManagementEndpoint(w http.ResponseWriter, r *http.Request)
HandlePluginManagementEndpoint provides HTTP endpoint for plugin management
func (*HockeypuckPluginHost) Initialize ¶
func (h *HockeypuckPluginHost) Initialize(ctx context.Context) error
Initialize discovers and starts all plugins
func (*HockeypuckPluginHost) NotifyKeyChange ¶
func (h *HockeypuckPluginHost) NotifyKeyChange(change hkpstorage.KeyChange) error
NotifyKeyChange notifies plugins of key changes (Hockeypuck storage integration)
func (*HockeypuckPluginHost) ReportSuspiciousActivity ¶
func (h *HockeypuckPluginHost) ReportSuspiciousActivity(remoteAddr, description string, severity string) error
ReportSuspiciousActivity reports suspicious activity to plugins
func (*HockeypuckPluginHost) RestartPlugin ¶
func (h *HockeypuckPluginHost) RestartPlugin(pluginName string) error
RestartPlugin restarts a specific plugin
type PluginClient ¶
type PluginClient struct {
// contains filtered or unexported fields
}
PluginClient manages gRPC connections to plugins
func NewPluginClient ¶
func NewPluginClient(manager *lifecycle.Manager, logger *logrus.Logger) *PluginClient
NewPluginClient creates a new plugin client
func (*PluginClient) CheckRateLimit ¶
func (pc *PluginClient) CheckRateLimit(identifier, action string, metadata map[string]string) (*proto.RateLimitResponse, error)
CheckRateLimit checks rate limits across all plugins
func (*PluginClient) Close ¶
func (pc *PluginClient) Close() error
Close closes all plugin connections
func (*PluginClient) ConnectToPlugin ¶
func (pc *PluginClient) ConnectToPlugin(pluginName string) error
ConnectToPlugin establishes a connection to a specific plugin
func (*PluginClient) ConnectToPlugins ¶
func (pc *PluginClient) ConnectToPlugins() error
ConnectToPlugins establishes connections to all running plugins
func (*PluginClient) DisconnectFromPlugin ¶
func (pc *PluginClient) DisconnectFromPlugin(pluginName string) error
DisconnectFromPlugin closes connection to a specific plugin
func (*PluginClient) GetConnectedPlugins ¶
func (pc *PluginClient) GetConnectedPlugins() []string
GetConnectedPlugins returns list of currently connected plugins
func (*PluginClient) GetPluginHealth ¶
func (pc *PluginClient) GetPluginHealth() map[string]*proto.HealthStatus
GetPluginHealth checks health of all connected plugins
func (*PluginClient) HTTPRequestMiddleware ¶
func (pc *PluginClient) HTTPRequestMiddleware(next http.Handler) http.Handler
HTTPRequestMiddleware processes HTTP requests through plugins
func (*PluginClient) HealthCheck ¶
func (pc *PluginClient) HealthCheck(ctx context.Context) error
HealthCheck performs health check on a specific plugin
func (*PluginClient) NotifyKeyChange ¶
func (pc *PluginClient) NotifyKeyChange(changeType proto.KeyChangeEvent_ChangeType, fingerprint string, keyData []byte) error
NotifyKeyChange sends key change events to all plugins
func (*PluginClient) QueryStorage ¶
func (pc *PluginClient) QueryStorage(queryType proto.StorageQuery_QueryType, query string, options map[string]string) (*proto.StorageResponse, error)
QueryStorage proxies storage queries to plugins that support it
func (*PluginClient) ReportThreat ¶
func (pc *PluginClient) ReportThreat(threatLevel proto.ThreatInfo_ThreatLevel, threatType, description, source string, indicators map[string]string) error
ReportThreat sends threat information to all plugins
type SimplePluginAdapter ¶
type SimplePluginAdapter struct {
// contains filtered or unexported fields
}
SimplePluginAdapter provides a minimal interface for Hockeypuck integration
func NewSimplePluginAdapter ¶
func NewSimplePluginAdapter(pluginDir string, logger *logrus.Logger) *SimplePluginAdapter
NewSimplePluginAdapter creates a new simple adapter
func (*SimplePluginAdapter) CheckRateLimit ¶
func (s *SimplePluginAdapter) CheckRateLimit(remoteAddr, operation string) (allowed bool, retryAfter int, reason string)
CheckRateLimit checks if a request should be rate limited
func (*SimplePluginAdapter) GetHealth ¶
func (s *SimplePluginAdapter) GetHealth() map[string]interface{}
GetHealth returns plugin health status
func (*SimplePluginAdapter) GetStatus ¶
func (s *SimplePluginAdapter) GetStatus() map[string]interface{}
GetStatus returns plugin status for monitoring
func (*SimplePluginAdapter) HTTPMiddleware ¶
func (s *SimplePluginAdapter) HTTPMiddleware() func(http.Handler) http.Handler
HTTPMiddleware returns middleware for HTTP request processing
func (*SimplePluginAdapter) HandleManagement ¶
func (s *SimplePluginAdapter) HandleManagement(w http.ResponseWriter, r *http.Request)
HandleManagement handles plugin management HTTP endpoints
func (*SimplePluginAdapter) OnKeyChange ¶
func (s *SimplePluginAdapter) OnKeyChange(change hkpstorage.KeyChange) error
OnKeyChange notifies plugins of key changes
func (*SimplePluginAdapter) ReportSuspiciousActivity ¶
func (s *SimplePluginAdapter) ReportSuspiciousActivity(remoteAddr, description string, severity string) error
ReportSuspiciousActivity reports suspicious activity to plugins