shared

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const PluginName = "plugin"

PluginName overwritten to be used by Privateer Core sally.go: rpcClient.Dispense(plugin.PluginName)

Variables

This section is empty.

Functions

func GetHandshakeConfig

func GetHandshakeConfig() hcplugin.HandshakeConfig

GetHandshakeConfig provides handshake config details. It is used by core and service packs.

func Serve

func Serve(pluginName string, opts *ServeOpts)

Serve serves a plugin. This function never returns and should be the final function called in the main function of the plugin.

Types

type Plugin

type Plugin struct {
	// Impl Injection
	Impl Pluginer
}

Plugin 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 (Plugin) Client

func (Plugin) Client(b *hcplugin.MuxBroker, c *rpc.Client) (interface{}, error)

Client implements RPC client

func (*Plugin) Server

func (p *Plugin) Server(*hcplugin.MuxBroker) (interface{}, error)

Server implements RPC server

type PluginRPC

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

PluginRPC is an implementation that talks over RPC

func (*PluginRPC) Start

func (g *PluginRPC) Start() error

Start is a wrapper for interface implementation of Start

type PluginRPCServer

type PluginRPCServer struct {
	// This is the real implementation
	Impl Pluginer
}

PluginRPCServer is the RPC server that PluginRPC talks to, conforming to the requirements of net/rpc

func (*PluginRPCServer) Start

func (s *PluginRPCServer) Start(args interface{}, resp *error) error

Start is a wrapper for interface implementation

type Pluginer

type Pluginer interface {
	Start() error
}

Plugin is the interface that we're exposing as a plugin.

type ServeOpts

type ServeOpts struct {
	//Interface implementation
	Plugin Pluginer

	// Logger is the logger that go-plugin will use.
	Logger hclog.Logger
}

ServeOpts are the configurations to serve a plugin.

Jump to

Keyboard shortcuts

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