Documentation ¶
Overview ¶
Package native provides a Go native plugin loader.
Native Go plugins are only supported in Go 1.8+ and in Linux platforms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PluginLoader ¶
type PluginLoader struct { // PluginDir is the directory where plugins will be loaded from PluginDir string }
PluginLoader uses the plugin mechanism introduced in Go 1.8 to laod compiled plugins from a given directory.
func (*PluginLoader) Load ¶
func (l *PluginLoader) Load(id string) (plugins.Plugin, error)
Load the given plugin using the native plugin support introduced in Go 1.8
Plugins must follow the plugin conventions:
- Be present in the configured 'PluginDir/name.so' (plugin name in lowercase)
- Must export a variable named 'Name' (the capitalized name of the plugin) of type 'enforcer.Plugin'
func (*PluginLoader) Unload ¶
func (l *PluginLoader) Unload(id string) error
Unload releases the resources used by a plugin. In Go 1.8, closing an open plugin is still not supported, so this method does nothing.
Click to show internal directories.
Click to hide internal directories.