Documentation
¶
Index ¶
- type Config
- type EventResponse
- type InteractiveRenderer
- func (r *InteractiveRenderer) Cleanup()
- func (r *InteractiveRenderer) Done() <-chan struct{}
- func (r *InteractiveRenderer) OnConnected()
- func (r *InteractiveRenderer) OnConnecting()
- func (r *InteractiveRenderer) OnConnectionWarning(activeRequests int32, maxConns int)
- func (r *InteractiveRenderer) OnDisconnected()
- func (r *InteractiveRenderer) OnError(err error)
- func (r *InteractiveRenderer) OnEventComplete(eventID string, attempt *websocket.Attempt, response *EventResponse, ...)
- func (r *InteractiveRenderer) OnEventError(eventID string, attempt *websocket.Attempt, err error, startTime time.Time)
- func (r *InteractiveRenderer) OnEventPending(eventID string, attempt *websocket.Attempt, startTime time.Time)
- type Proxy
- type Renderer
- type RendererConfig
- type SimpleRenderer
- func (r *SimpleRenderer) Cleanup()
- func (r *SimpleRenderer) Done() <-chan struct{}
- func (r *SimpleRenderer) OnConnected()
- func (r *SimpleRenderer) OnConnecting()
- func (r *SimpleRenderer) OnConnectionWarning(activeRequests int32, maxConns int)
- func (r *SimpleRenderer) OnDisconnected()
- func (r *SimpleRenderer) OnError(err error)
- func (r *SimpleRenderer) OnEventComplete(eventID string, attempt *websocket.Attempt, response *EventResponse, ...)
- func (r *SimpleRenderer) OnEventError(eventID string, attempt *websocket.Attempt, err error, startTime time.Time)
- func (r *SimpleRenderer) OnEventPending(eventID string, attempt *websocket.Attempt, startTime time.Time)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// DeviceName is the name of the device sent to Hookdeck to help identify the device
DeviceName string
// Key is the API key used to authenticate with Hookdeck
Key string
ProjectID string
ProjectMode string
URL *url.URL
APIBaseURL string
DashboardBaseURL string
ConsoleBaseURL string
WSBaseURL string
Log *log.Logger
// Force use of unencrypted ws:// protocol instead of wss://
NoWSS bool
Insecure bool
// Output mode: interactive, compact, quiet
Output string
GuestURL string
// MaxConnections allows tuning the maximum concurrent connections per host.
// Default: 50 concurrent connections
// This can be increased for high-volume testing scenarios where the local
// endpoint can handle more concurrent requests.
// Example: Set to 100+ when load testing with many parallel webhooks.
// Warning: Setting this too high may cause resource exhaustion.
MaxConnections int
// Filters for this CLI session
Filters *hookdeck.SessionFilters
}
Config provides the configuration of a Proxy
type EventResponse ¶
type EventResponse struct {
StatusCode int
Headers map[string][]string
Body string
Duration time.Duration
}
EventResponse contains the HTTP response data
type InteractiveRenderer ¶
type InteractiveRenderer struct {
// contains filtered or unexported fields
}
InteractiveRenderer renders events using Bubble Tea TUI
func NewInteractiveRenderer ¶
func NewInteractiveRenderer(cfg *RendererConfig) *InteractiveRenderer
NewInteractiveRenderer creates a new interactive renderer with Bubble Tea
func (*InteractiveRenderer) Cleanup ¶
func (r *InteractiveRenderer) Cleanup()
Cleanup gracefully stops the TUI and restores terminal
func (*InteractiveRenderer) Done ¶
func (r *InteractiveRenderer) Done() <-chan struct{}
Done returns a channel that is closed when the renderer wants to quit
func (*InteractiveRenderer) OnConnected ¶
func (r *InteractiveRenderer) OnConnected()
OnConnected is called when websocket connects
func (*InteractiveRenderer) OnConnecting ¶
func (r *InteractiveRenderer) OnConnecting()
OnConnecting is called when starting to connect
func (*InteractiveRenderer) OnConnectionWarning ¶
func (r *InteractiveRenderer) OnConnectionWarning(activeRequests int32, maxConns int)
OnConnectionWarning is called when approaching connection limits
func (*InteractiveRenderer) OnDisconnected ¶
func (r *InteractiveRenderer) OnDisconnected()
OnDisconnected is called when websocket disconnects
func (*InteractiveRenderer) OnError ¶
func (r *InteractiveRenderer) OnError(err error)
OnError is called when an error occurs
func (*InteractiveRenderer) OnEventComplete ¶
func (r *InteractiveRenderer) OnEventComplete(eventID string, attempt *websocket.Attempt, response *EventResponse, startTime time.Time)
OnEventComplete is called when an event completes successfully
func (*InteractiveRenderer) OnEventError ¶
func (r *InteractiveRenderer) OnEventError(eventID string, attempt *websocket.Attempt, err error, startTime time.Time)
OnEventError is called when an event encounters an error
func (*InteractiveRenderer) OnEventPending ¶
func (r *InteractiveRenderer) OnEventPending(eventID string, attempt *websocket.Attempt, startTime time.Time)
OnEventPending is called when an event starts (after 100ms delay)
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
A Proxy opens a websocket connection with Hookdeck, listens for incoming webhook events, forwards them to the local endpoint and sends the response back to Hookdeck.
func New ¶
func New(cfg *Config, connections []*hookdecksdk.Connection, renderer Renderer) *Proxy
New creates a new Proxy
type Renderer ¶
type Renderer interface {
// Lifecycle events
OnConnecting()
OnConnected()
OnDisconnected()
OnError(err error)
// Event handling
OnEventPending(eventID string, attempt *websocket.Attempt, startTime time.Time) // For interactive mode (100ms delay)
OnEventComplete(eventID string, attempt *websocket.Attempt, response *EventResponse, startTime time.Time)
OnEventError(eventID string, attempt *websocket.Attempt, err error, startTime time.Time)
// Connection warnings
OnConnectionWarning(activeRequests int32, maxConns int)
// Cleanup is called before exit to clean up resources (e.g., stop TUI, stop spinner)
Cleanup()
// Done returns a channel that signals when user wants to quit
Done() <-chan struct{}
}
Renderer is the interface for handling proxy output Implementations handle different output modes (interactive, compact, quiet)
func NewRenderer ¶
func NewRenderer(cfg *RendererConfig) Renderer
NewRenderer creates the appropriate renderer based on output mode
type RendererConfig ¶
type RendererConfig struct {
DeviceName string
APIKey string
APIBaseURL string
DashboardBaseURL string
ConsoleBaseURL string
ProjectMode string
ProjectID string
GuestURL string
TargetURL *url.URL
Output string
Sources []*hookdecksdk.Source
Connections []*hookdecksdk.Connection
Filters *hookdeck.SessionFilters
}
RendererConfig contains configuration for creating renderers
type SimpleRenderer ¶
type SimpleRenderer struct {
// contains filtered or unexported fields
}
SimpleRenderer renders events to stdout for compact and quiet modes
func NewSimpleRenderer ¶
func NewSimpleRenderer(cfg *RendererConfig, quietMode bool) *SimpleRenderer
NewSimpleRenderer creates a new simple renderer
func (*SimpleRenderer) Cleanup ¶
func (r *SimpleRenderer) Cleanup()
Cleanup stops the spinner and cleans up resources
func (*SimpleRenderer) Done ¶
func (r *SimpleRenderer) Done() <-chan struct{}
Done returns a channel that is closed when the renderer wants to quit
func (*SimpleRenderer) OnConnected ¶
func (r *SimpleRenderer) OnConnected()
OnConnected is called when websocket connects
func (*SimpleRenderer) OnConnecting ¶
func (r *SimpleRenderer) OnConnecting()
OnConnecting is called when starting to connect
func (*SimpleRenderer) OnConnectionWarning ¶
func (r *SimpleRenderer) OnConnectionWarning(activeRequests int32, maxConns int)
OnConnectionWarning is called when approaching connection limits
func (*SimpleRenderer) OnDisconnected ¶
func (r *SimpleRenderer) OnDisconnected()
OnDisconnected is called when websocket disconnects
func (*SimpleRenderer) OnError ¶
func (r *SimpleRenderer) OnError(err error)
OnError is called when an error occurs
func (*SimpleRenderer) OnEventComplete ¶
func (r *SimpleRenderer) OnEventComplete(eventID string, attempt *websocket.Attempt, response *EventResponse, startTime time.Time)
OnEventComplete is called when an event completes successfully
func (*SimpleRenderer) OnEventError ¶
func (r *SimpleRenderer) OnEventError(eventID string, attempt *websocket.Attempt, err error, startTime time.Time)
OnEventError is called when an event encounters an error
func (*SimpleRenderer) OnEventPending ¶
func (r *SimpleRenderer) OnEventPending(eventID string, attempt *websocket.Attempt, startTime time.Time)
OnEventPending is called when an event starts (not used in simple renderer)