Documentation ¶
Index ¶
- Constants
- func Verify(params, returnVal *structpb.Struct) bool
- type HookConfig
- func (h *HookConfig) Add(hookType HookType, prio Priority, hook HookDef)
- func (h *HookConfig) Get(hookType HookType) map[Priority]HookDef
- func (h *HookConfig) Hooks() map[HookType]map[Priority]HookDef
- func (h *HookConfig) Run(ctx context.Context, args *structpb.Struct, hookType HookType, ...) (*structpb.Struct, error)
- type HookDef
- type HookType
- type Identifier
- type Impl
- type Plugin
- type Policy
- type Priority
- type Registry
- type RegistryImpl
- func (reg *RegistryImpl) Add(plugin *Impl) bool
- func (reg *RegistryImpl) Get(id Identifier) *Impl
- func (reg *RegistryImpl) List() []Identifier
- func (reg *RegistryImpl) LoadPlugins(pluginConfig *koanf.Koanf)
- func (reg *RegistryImpl) RegisterHooks(id Identifier)
- func (reg *RegistryImpl) Remove(id Identifier)
- func (reg *RegistryImpl) Shutdown()
Constants ¶
View Source
const ( DefaultMinPort uint = 50000 DefaultMaxPort uint = 60000 PluginPriorityStart uint = 1000 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HookConfig ¶ added in v0.0.8
type HookConfig struct { Logger zerolog.Logger Verification Policy // contains filtered or unexported fields }
func NewHookConfig ¶ added in v0.0.8
func NewHookConfig() *HookConfig
func (*HookConfig) Add ¶ added in v0.0.8
func (h *HookConfig) Add(hookType HookType, prio Priority, hook HookDef)
func (*HookConfig) Get ¶ added in v0.0.8
func (h *HookConfig) Get(hookType HookType) map[Priority]HookDef
type HookType ¶ added in v0.0.8
type HookType string
const ( // Run command hooks (cmd/run.go). OnConfigLoaded HookType = "onConfigLoaded" OnNewLogger HookType = "onNewLogger" OnNewPool HookType = "onNewPool" OnNewProxy HookType = "onNewProxy" OnNewServer HookType = "onNewServer" OnSignal HookType = "onSignal" // Server hooks (network/server.go). OnRun HookType = "onRun" OnBooting HookType = "onBooting" OnBooted HookType = "onBooted" OnOpening HookType = "onOpening" OnOpened HookType = "onOpened" OnClosing HookType = "onClosing" OnClosed HookType = "onClosed" OnTraffic HookType = "onTraffic" OnIngressTraffic HookType = "onIngressTraffic" OnEgressTraffic HookType = "onEgressTraffic" OnShutdown HookType = "onShutdown" OnTick HookType = "onTick" // Pool hooks (network/pool.go). OnNewClient HookType = "onNewClient" )
type Identifier ¶ added in v0.0.8
type Impl ¶ added in v0.0.8
type Impl struct { goplugin.NetRPCUnsupportedPlugin pluginV1.GatewayDPluginServiceServer ID Identifier Description string Authors []string License string ProjectURL string LocalPath string Enabled bool // internal and external config options Config map[string]string // hooks it attaches to Hooks []HookType Priority Priority // required plugins to be loaded before this one // Built-in plugins are always loaded first Requires []Identifier Tags []string Categories []string // contains filtered or unexported fields }
type Priority ¶ added in v0.0.8
type Priority uint
Priority is the priority of a hook. Smaller values are executed first (higher priority).
type Registry ¶ added in v0.0.8
type Registry interface { Add(plugin *Impl) bool Get(id Identifier) *Impl List() []Identifier Remove(id Identifier) Shutdown() LoadPlugins(pluginConfig *koanf.Koanf) RegisterHooks(id Identifier) }
type RegistryImpl ¶ added in v0.0.8
type RegistryImpl struct {
// contains filtered or unexported fields
}
func NewRegistry ¶ added in v0.0.8
func NewRegistry(hooksConfig *HookConfig) *RegistryImpl
func (*RegistryImpl) Add ¶ added in v0.0.8
func (reg *RegistryImpl) Add(plugin *Impl) bool
func (*RegistryImpl) Get ¶ added in v0.0.8
func (reg *RegistryImpl) Get(id Identifier) *Impl
func (*RegistryImpl) List ¶ added in v0.0.8
func (reg *RegistryImpl) List() []Identifier
func (*RegistryImpl) LoadPlugins ¶ added in v0.0.8
func (reg *RegistryImpl) LoadPlugins(pluginConfig *koanf.Koanf)
func (*RegistryImpl) RegisterHooks ¶ added in v0.0.8
func (reg *RegistryImpl) RegisterHooks(id Identifier)
func (*RegistryImpl) Remove ¶ added in v0.0.8
func (reg *RegistryImpl) Remove(id Identifier)
func (*RegistryImpl) Shutdown ¶ added in v0.0.8
func (reg *RegistryImpl) Shutdown()
Click to show internal directories.
Click to hide internal directories.