Documentation ¶
Overview ¶
Package shared contains shared data between the host and plugins.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "BASIC_PLUGIN",
MagicCookieValue: "hello",
}
Handshake is used to just do a basic handshake between a plugin and host. If the handshake fails, a user friendly error is shown. This prevents users from executing bad plugins or executing a plugin directory. It is a UX feature, not a security feature.
var PluginMap = map[string]plugin.Plugin{ "customPlugin": &CustomPlugin{}, }
PluginMap is the map of plugins we can dispense.
Functions ¶
func SetupDefaults ¶
func SetupDefaults() map[string]interface{}
func SetupLogrus ¶
func SetupLogrus(info LogrusInfo) error
Types ¶
type CustomPlugin ¶
type CustomPlugin struct { // CustomPlugin must still implement the Plugin interface plugin.Plugin // Concrete implementation, written in Go. This is only used for plugins // that are written in Go. Impl Service }
CustomPlugin This is the implementation of plugin.Plugin so we can serve/consume this
This has two methods: Server must return an RPC server for this plugin type. We construct a GreeterRPCServer for this.
Client must return an implementation of our interface that communicates over an RPC client. We return GreeterRPC for this.
Ignore MuxBroker. That is used to create more multiplexed streams on our plugin connection and is a more advanced use case.
func (CustomPlugin) Client ¶
func (CustomPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
func (*CustomPlugin) Server ¶
func (p *CustomPlugin) Server(*plugin.MuxBroker) (interface{}, error)
type LogrusInfo ¶
type PluginRPC ¶
type PluginRPC struct {
// contains filtered or unexported fields
}
PluginRPC is an implementation that talks over RPC
type PluginRPCServer ¶
type PluginRPCServer struct { // This is the real implementation Impl Service }
PluginRPCServer is the RPC server that GreeterRPC talks to, conforming to the requirements of net/rpc
func (*PluginRPCServer) Start ¶
func (s *PluginRPCServer) Start(args interface{}, resp *string) error