char/pkg/register/plugin_api.go

21 lines
352 B
Go
Raw Normal View History

2022-11-01 14:26:54 +01:00
package register
import (
"net/rpc"
"github.com/hashicorp/go-plugin"
)
type PluginAPI struct {
2022-11-01 21:15:32 +01:00
path string
2022-11-01 14:26:54 +01:00
Impl Plugin
}
func (pa *PluginAPI) Server(*plugin.MuxBroker) (any, error) {
return &PluginServer{Impl: pa.Impl}, nil
}
func (*PluginAPI) Client(b *plugin.MuxBroker, c *rpc.Client) (any, error) {
return &PluginClient{client: c}, nil
}