regexreplace

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName = "regex_replace"

Variables

View Source
var (
	ErrNoRules       = errors.New("regex_replace: at least one rule is required")
	ErrInvalidTarget = errors.New("regex_replace: target must be one of request, response")
	ErrEmptyPattern  = errors.New("regex_replace: rule pattern must not be empty")
	ErrBadPattern    = errors.New("regex_replace: invalid regular expression")
)

Functions

This section is empty.

Types

type Data

type Data struct {
	Target   string `json:"target,omitempty"`
	Stage    string `json:"stage,omitempty"`
	Mode     string `json:"mode,omitempty"`
	Decision string `json:"decision,omitempty"`
	Changed  bool   `json:"changed,omitempty"`
}

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func New

func New(registry *adapter.Registry, logger *slog.Logger) *Plugin

func (*Plugin) Execute

func (p *Plugin) Execute(ctx context.Context, in appplugins.ExecInput) (*appplugins.Result, error)

func (*Plugin) MandatoryStages

func (p *Plugin) MandatoryStages() []policy.Stage

func (*Plugin) MutatesMetadata

func (p *Plugin) MutatesMetadata() bool

func (*Plugin) MutatesRequestBody

func (p *Plugin) MutatesRequestBody() bool

func (*Plugin) MutatesResponseBody

func (p *Plugin) MutatesResponseBody() bool

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) SupportedModes

func (p *Plugin) SupportedModes() []policy.Mode

func (*Plugin) SupportedProtocols

func (p *Plugin) SupportedProtocols() []appplugins.Protocol

func (*Plugin) SupportedStages

func (p *Plugin) SupportedStages() []policy.Stage

func (*Plugin) ValidateConfig

func (p *Plugin) ValidateConfig(settings map[string]any) error

type Rule

type Rule struct {
	Pattern         string `mapstructure:"pattern"`
	Replacement     string `mapstructure:"replacement"`
	CaseInsensitive bool   `mapstructure:"case_insensitive"`
	Multiline       bool   `mapstructure:"multiline"`
}

type Settings

type Settings struct {
	Target string `mapstructure:"target"`
	Rules  []Rule `mapstructure:"rules"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL