package shared import ( "github.com/hashicorp/go-plugin" ) type Plugin struct { Tag string P PluginService } func NewPlugin(p PluginService, tag string) *Plugin { return &Plugin{P: p, Tag: tag} } func PluginSet(opts ...*Plugin) plugin.PluginSet { plugins := make(map[string]plugin.Plugin, len(opts)) for _, opt := range opts { plugins[opt.Tag] = &GRPCPlugin{Impl: opt.P} } return plugins } func HandshakeConfig(version uint, cookieKey, cookieValue string) plugin.HandshakeConfig { return plugin.HandshakeConfig{ ProtocolVersion: version, MagicCookieKey: cookieKey, MagicCookieValue: cookieValue, } }