Documentation
¶
Overview ¶
Package examples contains example plugin implementations for AegisGate.
Index ¶
- type AnalyticsMetrics
- type ExampleAnalyticsPlugin
- func (p *ExampleAnalyticsPlugin) GetMetrics() *AnalyticsMetrics
- func (p *ExampleAnalyticsPlugin) Hooks() []plugin.HookType
- func (p *ExampleAnalyticsPlugin) Init(ctx context.Context, config plugin.PluginConfig) error
- func (p *ExampleAnalyticsPlugin) Metadata() plugin.PluginMetadata
- func (p *ExampleAnalyticsPlugin) ProcessRequest(ctx context.Context, reqCtx *plugin.RequestContext) (*plugin.HookResult, error)
- func (p *ExampleAnalyticsPlugin) ProcessResponse(ctx context.Context, reqCtx *plugin.RequestContext, ...) (*plugin.HookResult, error)
- func (p *ExampleAnalyticsPlugin) Start(ctx context.Context) error
- func (p *ExampleAnalyticsPlugin) Stop(ctx context.Context) error
- type ExampleFilterPlugin
- func (p *ExampleFilterPlugin) GetStats() *FilterStats
- func (p *ExampleFilterPlugin) Hooks() []plugin.HookType
- func (p *ExampleFilterPlugin) Init(ctx context.Context, config plugin.PluginConfig) error
- func (p *ExampleFilterPlugin) Metadata() plugin.PluginMetadata
- func (p *ExampleFilterPlugin) OnError(ctx context.Context, errCtx *plugin.ErrorContext) error
- func (p *ExampleFilterPlugin) ProcessRequest(ctx context.Context, reqCtx *plugin.RequestContext) (*plugin.HookResult, error)
- func (p *ExampleFilterPlugin) ProcessResponse(ctx context.Context, reqCtx *plugin.RequestContext, ...) (*plugin.HookResult, error)
- func (p *ExampleFilterPlugin) Start(ctx context.Context) error
- func (p *ExampleFilterPlugin) Stop(ctx context.Context) error
- type ExamplePeriodicPlugin
- func (p *ExamplePeriodicPlugin) GetTaskCount() int
- func (p *ExamplePeriodicPlugin) Hooks() []plugin.HookType
- func (p *ExamplePeriodicPlugin) Init(ctx context.Context, config plugin.PluginConfig) error
- func (p *ExamplePeriodicPlugin) Interval() time.Duration
- func (p *ExamplePeriodicPlugin) Metadata() plugin.PluginMetadata
- func (p *ExamplePeriodicPlugin) OnPeriodic(ctx context.Context, periodicCtx *plugin.PeriodicContext) error
- func (p *ExamplePeriodicPlugin) Start(ctx context.Context) error
- func (p *ExamplePeriodicPlugin) Stop(ctx context.Context) error
- type FilterStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalyticsMetrics ¶
type AnalyticsMetrics struct {
TotalRequests int64
TotalResponses int64
TotalBytesIn int64
TotalBytesOut int64
AvgLatency time.Duration
TopPaths map[string]int
StatusCodes map[int]int
}
AnalyticsMetrics holds analytics data
type ExampleAnalyticsPlugin ¶
type ExampleAnalyticsPlugin struct {
// contains filtered or unexported fields
}
ExampleAnalyticsPlugin demonstrates an analytics plugin
func NewExampleAnalyticsPlugin ¶
func NewExampleAnalyticsPlugin() *ExampleAnalyticsPlugin
NewExampleAnalyticsPlugin creates a new analytics plugin
func (*ExampleAnalyticsPlugin) GetMetrics ¶
func (p *ExampleAnalyticsPlugin) GetMetrics() *AnalyticsMetrics
GetMetrics returns the analytics metrics
func (*ExampleAnalyticsPlugin) Hooks ¶
func (p *ExampleAnalyticsPlugin) Hooks() []plugin.HookType
Hooks returns the hooks this plugin implements
func (*ExampleAnalyticsPlugin) Init ¶
func (p *ExampleAnalyticsPlugin) Init(ctx context.Context, config plugin.PluginConfig) error
Init initializes the plugin
func (*ExampleAnalyticsPlugin) Metadata ¶
func (p *ExampleAnalyticsPlugin) Metadata() plugin.PluginMetadata
Metadata returns the plugin metadata
func (*ExampleAnalyticsPlugin) ProcessRequest ¶
func (p *ExampleAnalyticsPlugin) ProcessRequest(ctx context.Context, reqCtx *plugin.RequestContext) (*plugin.HookResult, error)
ProcessRequest tracks request metrics
func (*ExampleAnalyticsPlugin) ProcessResponse ¶
func (p *ExampleAnalyticsPlugin) ProcessResponse(ctx context.Context, reqCtx *plugin.RequestContext, respCtx *plugin.ResponseContext) (*plugin.HookResult, error)
ProcessResponse tracks response metrics
type ExampleFilterPlugin ¶
type ExampleFilterPlugin struct {
// contains filtered or unexported fields
}
ExampleFilterPlugin is a simple filter plugin that logs requests and responses. This demonstrates how to implement a filter plugin.
func NewExampleFilterPlugin ¶
func NewExampleFilterPlugin() *ExampleFilterPlugin
NewExampleFilterPlugin creates a new example filter plugin
func (*ExampleFilterPlugin) GetStats ¶
func (p *ExampleFilterPlugin) GetStats() *FilterStats
GetStats returns the filter statistics
func (*ExampleFilterPlugin) Hooks ¶
func (p *ExampleFilterPlugin) Hooks() []plugin.HookType
Hooks returns the hooks this plugin implements
func (*ExampleFilterPlugin) Init ¶
func (p *ExampleFilterPlugin) Init(ctx context.Context, config plugin.PluginConfig) error
Init initializes the plugin
func (*ExampleFilterPlugin) Metadata ¶
func (p *ExampleFilterPlugin) Metadata() plugin.PluginMetadata
Metadata returns the plugin metadata
func (*ExampleFilterPlugin) OnError ¶
func (p *ExampleFilterPlugin) OnError(ctx context.Context, errCtx *plugin.ErrorContext) error
OnError handles errors (for ErrorHandler interface)
func (*ExampleFilterPlugin) ProcessRequest ¶
func (p *ExampleFilterPlugin) ProcessRequest(ctx context.Context, reqCtx *plugin.RequestContext) (*plugin.HookResult, error)
ProcessRequest handles the request received hook
func (*ExampleFilterPlugin) ProcessResponse ¶
func (p *ExampleFilterPlugin) ProcessResponse(ctx context.Context, reqCtx *plugin.RequestContext, respCtx *plugin.ResponseContext) (*plugin.HookResult, error)
ProcessResponse handles the response sent hook
type ExamplePeriodicPlugin ¶
type ExamplePeriodicPlugin struct {
// contains filtered or unexported fields
}
ExamplePeriodicPlugin demonstrates a plugin with periodic tasks
func NewExamplePeriodicPlugin ¶
func NewExamplePeriodicPlugin() *ExamplePeriodicPlugin
NewExamplePeriodicPlugin creates a new periodic task plugin
func (*ExamplePeriodicPlugin) GetTaskCount ¶
func (p *ExamplePeriodicPlugin) GetTaskCount() int
GetTaskCount returns the number of tasks executed
func (*ExamplePeriodicPlugin) Hooks ¶
func (p *ExamplePeriodicPlugin) Hooks() []plugin.HookType
Hooks returns the hooks this plugin implements
func (*ExamplePeriodicPlugin) Init ¶
func (p *ExamplePeriodicPlugin) Init(ctx context.Context, config plugin.PluginConfig) error
Init initializes the plugin
func (*ExamplePeriodicPlugin) Interval ¶
func (p *ExamplePeriodicPlugin) Interval() time.Duration
Interval returns the interval for periodic tasks
func (*ExamplePeriodicPlugin) Metadata ¶
func (p *ExamplePeriodicPlugin) Metadata() plugin.PluginMetadata
Metadata returns the plugin metadata
func (*ExamplePeriodicPlugin) OnPeriodic ¶
func (p *ExamplePeriodicPlugin) OnPeriodic(ctx context.Context, periodicCtx *plugin.PeriodicContext) error
OnPeriodic runs the periodic task
type FilterStats ¶
FilterStats tracks filter statistics