plugin

package
v0.7.0-rc1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPlugin added in v0.7.0

func RegisterPlugin(typ Type, name string, fn NewPluginFunc)

Types

type BasePlugin added in v0.7.0

type BasePlugin[T any] struct {
	Name   string
	Config T
}

func (*BasePlugin[T]) ExecuteInbound added in v0.7.0

func (p *BasePlugin[T]) ExecuteInbound(inbound *Inbound) (InboundResult, error)

func (*BasePlugin[T]) ExecuteOutbound added in v0.7.0

func (p *BasePlugin[T]) ExecuteOutbound(outbound *Outbound, context *Context) error

func (*BasePlugin[T]) MarshalConfig added in v0.7.0

func (p *BasePlugin[T]) MarshalConfig() ([]byte, error)

func (*BasePlugin[T]) UnmarshalConfig added in v0.7.0

func (p *BasePlugin[T]) UnmarshalConfig(data []byte) error

type Context added in v0.7.0

type Context struct {
}

type Inbound added in v0.7.0

type Inbound struct {
	Request  *http.Request
	Response http.ResponseWriter
	RawBody  []byte
}

type InboundResult added in v0.7.0

type InboundResult struct {
	Terminated bool
	Payload    []byte
}

type NewPluginFunc added in v0.7.0

type NewPluginFunc func(config []byte) (Plugin, error)

type Outbound added in v0.7.0

type Outbound struct {
	URL     string            `json:"url"`
	Method  string            `json:"method"`
	Headers map[string]string `json:"headers"`
	Payload string            `json:"payload"`
}

type Plugin added in v0.7.0

type Plugin interface {
	ExecuteOutbound(outbound *Outbound, context *Context) error
	ExecuteInbound(inbound *Inbound) (InboundResult, error)
	ValidateConfig() error
	MarshalConfig() ([]byte, error)
}

type Registration added in v0.7.0

type Registration struct {
	Type Type
	New  NewPluginFunc
}

func GetRegistration added in v0.7.0

func GetRegistration(name string) *Registration

type Type added in v0.7.0

type Type string
const (
	TypeInbound  Type = "inbound"
	TypeOutbound Type = "outbound"
)

Jump to

Keyboard shortcuts

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