{"modulePath":"github.com/hashicorp/go-plugin","version":"v1.8.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package shared\n\n## Types\n\n```go\ntype Greeter interface {\n\tGreet() string\n}\n```\nGreeter is the interface that we're exposing as a plugin.\n\n```go\ntype GreeterPlugin struct {\n\t// Impl Injection\n\tImpl Greeter\n}\n```\nThis is the implementation of plugin.Plugin so we can serve/consume this\n\nThis has two methods: Server must return an RPC server for this plugin type. We construct a GreeterRPCServer for this.\n\nClient must return an implementation of our interface that communicates over an RPC client. We return GreeterRPC for this.\n\nIgnore MuxBroker. That is used to create more multiplexed streams on our plugin connection and is a more advanced use case.\n\n```go\nfunc (GreeterPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)\n```\n\n```go\nfunc (p *GreeterPlugin) Server(*plugin.MuxBroker) (interface{}, error)\n```\n\n```go\ntype GreeterRPC struct {\n\t// contains filtered or unexported fields\n}\n```\nHere is an implementation that talks over RPC\n\n```go\nfunc (g *GreeterRPC) Greet() string\n```\n\n```go\ntype GreeterRPCServer struct {\n\t// This is the real implementation\n\tImpl Greeter\n}\n```\nHere is the RPC server that GreeterRPC talks to, conforming to the requirements of net/rpc\n\n```go\nfunc (s *GreeterRPCServer) Greet(args interface{}, resp *string) error\n```\n\n","path":"github.com/hashicorp/go-plugin/examples/basic/shared","name":"shared","synopsis":"","isRedistributable":true}
