commons

package
v0.0.0-...-2ed1a0f Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

HandshakeConfig is a common handshake that is shared by plugin and host.

Functions

This section is empty.

Types

type Sayer

type Sayer interface {
	Says() string
}

Sayer says what an animal says.

type SayerPlugin

type SayerPlugin struct {
	Impl Sayer
}

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 SayerRPCServer for this.

Client must return an implementation of our interface that communicates over an RPC client. We return SayerRPC for this.

Ignore MuxBroker. That is used to create more multiplexed streams on our plugin connection and is a more advanced use case.

func (SayerPlugin) Client

func (SayerPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (*SayerPlugin) Server

func (p *SayerPlugin) Server(*plugin.MuxBroker) (interface{}, error)

type SayerRPC

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

Here is an implementation that talks over RPC

func (*SayerRPC) Says

func (g *SayerRPC) Says() string

type SayerRPCServer

type SayerRPCServer struct {
	// This is the real implementation
	Impl Sayer
}

Here is the RPC server that SayerRPC talks to, conforming to the requirements of net/rpc

func (*SayerRPCServer) Says

func (s *SayerRPCServer) Says(args interface{}, resp *string) error

Jump to

Keyboard shortcuts

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