shared

package module
v0.0.0-...-b19801f Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

README

plugin-shared

shared library for go-plugin

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HandshakeConfig = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "BASIC_PLUGIN",
	MagicCookieValue: "hello",
}

handshakeConfigs are 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.

Functions

This section is empty.

Types

type GRPCClient

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

GRPCClient is an implementation of KV that talks over RPC.

func (*GRPCClient) Start

func (g *GRPCClient) Start(ctx context.Context, req *protobuf.Empty) (*protobuf.Empty, error)

type GRPCServer

type GRPCServer struct {
	// This is the real implementation
	Impl KCP
}

Here is the gRPC server that GRPCClient talks to.

func (*GRPCServer) Start

func (g *GRPCServer) Start(ctx context.Context, req *protobuf.Empty) (*protobuf.Empty, error)

type KCP

type KCP interface {
	Start() error
}

type KCPGRPCPlugin

type KCPGRPCPlugin struct {
	// GRPCPlugin 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 KCP
}

This is the implementation of plugin.GRPCPlugin so we can serve/consume this.

func (*KCPGRPCPlugin) GRPCClient

func (p *KCPGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*KCPGRPCPlugin) GRPCServer

func (p *KCPGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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