Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a generic websocket client connection to an rpc-snooper instance
func NewClient ¶
func NewClient(config ClientConfig) *Client
NewClient creates a new generic snooper client
func (*Client) IsConnected ¶
IsConnected returns whether the client is currently connected
func (*Client) RegisterModule ¶
func (c *Client) RegisterModule(config ModuleConfig) (*ModuleRegistration, error)
RegisterModule registers a module configuration that will be registered with the snooper
func (*Client) UnregisterModule ¶
func (c *Client) UnregisterModule(module *ModuleRegistration) error
UnregisterModule unregisters a module
type ClientConfig ¶
type ClientConfig struct {
URL string
Logger logrus.FieldLogger
ReconnectDelay time.Duration
MaxReconnectDelay time.Duration
}
ClientConfig holds configuration for the generic client
type ModuleConfig ¶
type ModuleConfig struct {
Type string // Module type (e.g., "response_tracer", "request_snooper")
Name string // Human-readable name
Config map[string]any // Module-specific configuration
}
ModuleConfig represents the configuration for a snooper module
type ModuleRegistration ¶
type ModuleRegistration struct {
Config ModuleConfig
ModuleID uint64
// contains filtered or unexported fields
}
ModuleRegistration represents a registered module
func (*ModuleRegistration) FireEvent ¶
func (m *ModuleRegistration) FireEvent(event *WSMessageWithBinary)
FireEvent sends an event to all subscribers of this module
func (*ModuleRegistration) Subscribe ¶
func (m *ModuleRegistration) Subscribe(capacity int, blocking bool) *utils.Subscription[*WSMessageWithBinary]
Subscribe creates a subscription for events from this module
type RegisterModuleRequest ¶
type RegisterModuleRequest struct {
Type string `json:"type"`
Name string `json:"name"`
Config map[string]any `json:"config"`
}
RegisterModuleRequest represents a module registration request
type RegisterModuleResponse ¶
type RegisterModuleResponse struct {
Success bool `json:"success"`
ModuleID uint64 `json:"module_id,omitempty"`
Message string `json:"message,omitempty"`
}
RegisterModuleResponse represents a module registration response
type TracerEvent ¶
type TracerEvent struct {
ModuleID uint64 `json:"module_id"`
RequestID uint64 `json:"request_id"`
Duration int64 `json:"duration_ms"`
ResponseSize int64 `json:"response_size"`
RequestSize int64 `json:"request_size"`
StatusCode int `json:"status_code"`
RequestData any `json:"request_data,omitempty"`
ResponseData any `json:"response_data,omitempty"`
}
TracerEvent represents a tracer event from the snooper
type WSMessage ¶
type WSMessage struct {
RequestID uint64 `json:"reqid,omitempty"`
ResponseID uint64 `json:"rspid,omitempty"`
ModuleID uint64 `json:"modid,omitempty"`
Method string `json:"method"`
Data any `json:"data,omitempty"`
Error *string `json:"error,omitempty"`
Timestamp int64 `json:"time"`
Binary bool `json:"binary,omitempty"`
}
WSMessage represents a websocket message in the snooper protocol
type WSMessageWithBinary ¶
WSMessageWithBinary represents a websocket message with optional binary data