package myplugin
import (
"context"
"fmt"
"trustgate/pkg/types"
)
type MyPlugin struct{}
func (p *MyPlugin) Name() string {
return "my_custom_plugin"
}
func (p *MyPlugin) Stages() []types.Stage {
return nil // allow stage to be set via config
}
func (p *MyPlugin) AllowedStages() []types.Stage {
return []types.Stage{
types.StagePreRequest,
types.StagePostRequest,
}
}
func (p *MyPlugin) Execute(
ctx context.Context,
cfg types.PluginConfig,
req *types.RequestContext,
resp *types.ResponseContext,
) (*types.PluginResponse, error) {
fmt.Println("Executing custom plugin logic...")
return &types.PluginResponse{
Status: types.PluginStatusContinue,
}, nil
}
func (p *MyPlugin) ValidateConfig(config types.PluginConfig) error {
// Optional: validate plugin-specific settings
return nil
}
func New() types.Plugin {
return &MyPlugin{}
}