Files
mostlymatter/plugin/client_rpc.go
Haardik Dharma ea61458f16 Fix initialism errors (PR-3) (#17062)
* Fix initialism errors

* Revert some changes and regenerate file

* Update client4.go

* Update group_test.go

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-03-22 22:38:19 +03:00

779 строки
22 KiB
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
//go:generate go run interface_generator/main.go
package plugin
import (
"bytes"
"encoding/gob"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"net/rpc"
"os"
"reflect"
"github.com/dyatlov/go-opengraph/opengraph"
"github.com/hashicorp/go-plugin"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/shared/mlog"
)
var hookNameToId map[string]int = make(map[string]int)
type hooksRPCClient struct {
client *rpc.Client
log *mlog.Logger
muxBroker *plugin.MuxBroker
apiImpl API
implemented [TotalHooksID]bool
}
type hooksRPCServer struct {
impl interface{}
muxBroker *plugin.MuxBroker
apiRPCClient *apiRPCClient
}
// Implements hashicorp/go-plugin/plugin.Plugin interface to connect the hooks of a plugin
type hooksPlugin struct {
hooks interface{}
apiImpl API
log *mlog.Logger
}
func (p *hooksPlugin) Server(b *plugin.MuxBroker) (interface{}, error) {
return &hooksRPCServer{impl: p.hooks, muxBroker: b}, nil
}
func (p *hooksPlugin) Client(b *plugin.MuxBroker, client *rpc.Client) (interface{}, error) {
return &hooksRPCClient{client: client, log: p.log, muxBroker: b, apiImpl: p.apiImpl}, nil
}
type apiRPCClient struct {
client *rpc.Client
muxBroker *plugin.MuxBroker
}
type apiRPCServer struct {
impl API
muxBroker *plugin.MuxBroker
}
// ErrorString is a fallback for sending unregistered implementations of the error interface across
// rpc. For example, the errorString type from the github.com/pkg/errors package cannot be
// registered since it is not exported, but this precludes common error handling paradigms.
// ErrorString merely preserves the string description of the error, while satisfying the error
// interface itself to allow other registered types (such as model.AppError) to be sent unmodified.
type ErrorString struct {
Err string
}
func (e ErrorString) Error() string {
return e.Err
}
func encodableError(err error) error {
if err == nil {
return nil
}
if _, ok := err.(*model.AppError); ok {
return err
}
return &ErrorString{
Err: err.Error(),
}
}
// Registering some types used by MM for encoding/gob used by rpc
func init() {
gob.Register([]*model.SlackAttachment{})
gob.Register([]interface{}{})
gob.Register(map[string]interface{}{})
gob.Register(&model.AppError{})
gob.Register(&ErrorString{})
gob.Register(&opengraph.OpenGraph{})
gob.Register(&model.AutocompleteDynamicListArg{})
gob.Register(&model.AutocompleteStaticListArg{})
gob.Register(&model.AutocompleteTextArg{})
}
// These enforce compile time checks to make sure types implement the interface
// If you are getting an error here, you probably need to run `make pluginapi` to
// autogenerate RPC glue code
var _ plugin.Plugin = &hooksPlugin{}
var _ Hooks = &hooksRPCClient{}
//
// Below are special cases for hooks or APIs that can not be auto generated
//
func (g *hooksRPCClient) Implemented() (impl []string, err error) {
err = g.client.Call("Plugin.Implemented", struct{}{}, &impl)
for _, hookName := range impl {
if hookID, ok := hookNameToId[hookName]; ok {
g.implemented[hookID] = true
}
}
return
}
// Implemented replies with the names of the hooks that are implemented.
func (s *hooksRPCServer) Implemented(args struct{}, reply *[]string) error {
ifaceType := reflect.TypeOf((*Hooks)(nil)).Elem()
implType := reflect.TypeOf(s.impl)
selfType := reflect.TypeOf(s)
var methods []string
for i := 0; i < ifaceType.NumMethod(); i++ {
method := ifaceType.Method(i)
if m, ok := implType.MethodByName(method.Name); !ok {
continue
} else if m.Type.NumIn() != method.Type.NumIn()+1 {
continue
} else if m.Type.NumOut() != method.Type.NumOut() {
continue
} else {
match := true
for j := 0; j < method.Type.NumIn(); j++ {
if m.Type.In(j+1) != method.Type.In(j) {
match = false
break
}
}
for j := 0; j < method.Type.NumOut(); j++ {
if m.Type.Out(j) != method.Type.Out(j) {
match = false
break
}
}
if !match {
continue
}
}
if _, ok := selfType.MethodByName(method.Name); !ok {
continue
}
methods = append(methods, method.Name)
}
*reply = methods
return encodableError(nil)
}
type ZOnActivateArgs struct {
APIMuxID uint32
}
type ZOnActivateReturns struct {
A error
}
func (g *hooksRPCClient) OnActivate() error {
muxID := g.muxBroker.NextId()
go g.muxBroker.AcceptAndServe(muxID, &apiRPCServer{
impl: g.apiImpl,
muxBroker: g.muxBroker,
})
_args := &ZOnActivateArgs{
APIMuxID: muxID,
}
_returns := &ZOnActivateReturns{}
if err := g.client.Call("Plugin.OnActivate", _args, _returns); err != nil {
g.log.Error("RPC call to OnActivate plugin failed.", mlog.Err(err))
}
return _returns.A
}
func (s *hooksRPCServer) OnActivate(args *ZOnActivateArgs, returns *ZOnActivateReturns) error {
connection, err := s.muxBroker.Dial(args.APIMuxID)
if err != nil {
return err
}
s.apiRPCClient = &apiRPCClient{
client: rpc.NewClient(connection),
muxBroker: s.muxBroker,
}
if mmplugin, ok := s.impl.(interface {
SetAPI(api API)
SetHelpers(helpers Helpers)
}); ok {
mmplugin.SetAPI(s.apiRPCClient)
mmplugin.SetHelpers(&HelpersImpl{API: s.apiRPCClient})
}
if mmplugin, ok := s.impl.(interface {
OnConfigurationChange() error
}); ok {
if err := mmplugin.OnConfigurationChange(); err != nil {
fmt.Fprintf(os.Stderr, "[ERROR] call to OnConfigurationChange failed, error: %v", err.Error())
}
}
// Capture output of standard logger because go-plugin
// redirects it.
log.SetOutput(os.Stderr)
if hook, ok := s.impl.(interface {
OnActivate() error
}); ok {
returns.A = encodableError(hook.OnActivate())
}
return nil
}
type ZLoadPluginConfigurationArgsArgs struct {
}
type ZLoadPluginConfigurationArgsReturns struct {
A []byte
}
func (g *apiRPCClient) LoadPluginConfiguration(dest interface{}) error {
_args := &ZLoadPluginConfigurationArgsArgs{}
_returns := &ZLoadPluginConfigurationArgsReturns{}
if err := g.client.Call("Plugin.LoadPluginConfiguration", _args, _returns); err != nil {
log.Printf("RPC call to LoadPluginConfiguration API failed: %s", err.Error())
}
if err := json.Unmarshal(_returns.A, dest); err != nil {
log.Printf("LoadPluginConfiguration API failed to unmarshal: %s", err.Error())
}
return nil
}
func (s *apiRPCServer) LoadPluginConfiguration(args *ZLoadPluginConfigurationArgsArgs, returns *ZLoadPluginConfigurationArgsReturns) error {
var config interface{}
if hook, ok := s.impl.(interface {
LoadPluginConfiguration(dest interface{}) error
}); ok {
if err := hook.LoadPluginConfiguration(&config); err != nil {
return err
}
}
b, err := json.Marshal(config)
if err != nil {
return err
}
returns.A = b
return nil
}
func init() {
hookNameToId["ServeHTTP"] = ServeHTTPID
}
type ZServeHTTPArgs struct {
ResponseWriterStream uint32
Request *http.Request
Context *Context
RequestBodyStream uint32
}
func (g *hooksRPCClient) ServeHTTP(c *Context, w http.ResponseWriter, r *http.Request) {
if !g.implemented[ServeHTTPID] {
http.NotFound(w, r)
return
}
serveHTTPStreamID := g.muxBroker.NextId()
go func() {
connection, err := g.muxBroker.Accept(serveHTTPStreamID)
if err != nil {
g.log.Error("Plugin failed to ServeHTTP, muxBroker couldn't accept connection", mlog.Uint32("serve_http_stream_id", serveHTTPStreamID), mlog.Err(err))
return
}
defer connection.Close()
rpcServer := rpc.NewServer()
if err := rpcServer.RegisterName("Plugin", &httpResponseWriterRPCServer{w: w, log: g.log}); err != nil {
g.log.Error("Plugin failed to ServeHTTP, couldn't register RPC name", mlog.Err(err))
return
}
rpcServer.ServeConn(connection)
}()
requestBodyStreamID := uint32(0)
if r.Body != nil {
requestBodyStreamID = g.muxBroker.NextId()
go func() {
bodyConnection, err := g.muxBroker.Accept(requestBodyStreamID)
if err != nil {
g.log.Error("Plugin failed to ServeHTTP, muxBroker couldn't Accept request body connection", mlog.Err(err))
return
}
defer bodyConnection.Close()
serveIOReader(r.Body, bodyConnection)
}()
}
forwardedRequest := &http.Request{
Method: r.Method,
URL: r.URL,
Proto: r.Proto,
ProtoMajor: r.ProtoMajor,
ProtoMinor: r.ProtoMinor,
Header: r.Header,
Host: r.Host,
RemoteAddr: r.RemoteAddr,
RequestURI: r.RequestURI,
}
if err := g.client.Call("Plugin.ServeHTTP", ZServeHTTPArgs{
Context: c,
ResponseWriterStream: serveHTTPStreamID,
Request: forwardedRequest,
RequestBodyStream: requestBodyStreamID,
}, nil); err != nil {
g.log.Error("Plugin failed to ServeHTTP, RPC call failed", mlog.Err(err))
http.Error(w, "500 internal server error", http.StatusInternalServerError)
}
}
func (s *hooksRPCServer) ServeHTTP(args *ZServeHTTPArgs, returns *struct{}) error {
connection, err := s.muxBroker.Dial(args.ResponseWriterStream)
if err != nil {
fmt.Fprintf(os.Stderr, "[ERROR] Can't connect to remote response writer stream, error: %v", err.Error())
return err
}
w := connectHTTPResponseWriter(connection)
defer w.Close()
r := args.Request
if args.RequestBodyStream != 0 {
connection, err := s.muxBroker.Dial(args.RequestBodyStream)
if err != nil {
fmt.Fprintf(os.Stderr, "[ERROR] Can't connect to remote request body stream, error: %v", err.Error())
return err
}
r.Body = connectIOReader(connection)
} else {
r.Body = ioutil.NopCloser(&bytes.Buffer{})
}
defer r.Body.Close()
if hook, ok := s.impl.(interface {
ServeHTTP(c *Context, w http.ResponseWriter, r *http.Request)
}); ok {
hook.ServeHTTP(args.Context, w, r)
} else {
http.NotFound(w, r)
}
return nil
}
type ZPluginHTTPArgs struct {
Request *http.Request
RequestBody []byte
}
type ZPluginHTTPReturns struct {
Response *http.Response
ResponseBody []byte
}
func (g *apiRPCClient) PluginHTTP(request *http.Request) *http.Response {
forwardedRequest := &http.Request{
Method: request.Method,
URL: request.URL,
Proto: request.Proto,
ProtoMajor: request.ProtoMajor,
ProtoMinor: request.ProtoMinor,
Header: request.Header,
Host: request.Host,
RemoteAddr: request.RemoteAddr,
RequestURI: request.RequestURI,
}
requestBody, err := ioutil.ReadAll(request.Body)
if err != nil {
log.Printf("RPC call to PluginHTTP API failed: %s", err.Error())
return nil
}
request.Body.Close()
request.Body = nil
_args := &ZPluginHTTPArgs{
Request: forwardedRequest,
RequestBody: requestBody,
}
_returns := &ZPluginHTTPReturns{}
if err := g.client.Call("Plugin.PluginHTTP", _args, _returns); err != nil {
log.Printf("RPC call to PluginHTTP API failed: %s", err.Error())
return nil
}
_returns.Response.Body = ioutil.NopCloser(bytes.NewBuffer(_returns.ResponseBody))
return _returns.Response
}
func (s *apiRPCServer) PluginHTTP(args *ZPluginHTTPArgs, returns *ZPluginHTTPReturns) error {
args.Request.Body = ioutil.NopCloser(bytes.NewBuffer(args.RequestBody))
if hook, ok := s.impl.(interface {
PluginHTTP(request *http.Request) *http.Response
}); ok {
response := hook.PluginHTTP(args.Request)
responseBody, err := ioutil.ReadAll(response.Body)
if err != nil {
return encodableError(fmt.Errorf("RPC call to PluginHTTP API failed: %s", err.Error()))
}
response.Body.Close()
response.Body = nil
returns.Response = response
returns.ResponseBody = responseBody
} else {
return encodableError(fmt.Errorf("API PluginHTTP called but not implemented"))
}
return nil
}
func init() {
hookNameToId["FileWillBeUploaded"] = FileWillBeUploadedID
}
type ZFileWillBeUploadedArgs struct {
A *Context
B *model.FileInfo
UploadedFileStream uint32
ReplacementFileStream uint32
}
type ZFileWillBeUploadedReturns struct {
A *model.FileInfo
B string
}
func (g *hooksRPCClient) FileWillBeUploaded(c *Context, info *model.FileInfo, file io.Reader, output io.Writer) (*model.FileInfo, string) {
if !g.implemented[FileWillBeUploadedID] {
return info, ""
}
uploadedFileStreamID := g.muxBroker.NextId()
go func() {
uploadedFileConnection, err := g.muxBroker.Accept(uploadedFileStreamID)
if err != nil {
g.log.Error("Plugin failed to serve upload file stream. MuxBroker could not Accept connection", mlog.Err(err))
return
}
defer uploadedFileConnection.Close()
serveIOReader(file, uploadedFileConnection)
}()
replacementDone := make(chan bool)
replacementFileStreamID := g.muxBroker.NextId()
go func() {
defer close(replacementDone)
replacementFileConnection, err := g.muxBroker.Accept(replacementFileStreamID)
if err != nil {
g.log.Error("Plugin failed to serve replacement file stream. MuxBroker could not Accept connection", mlog.Err(err))
return
}
defer replacementFileConnection.Close()
if _, err := io.Copy(output, replacementFileConnection); err != nil {
g.log.Error("Error reading replacement file.", mlog.Err(err))
}
}()
_args := &ZFileWillBeUploadedArgs{c, info, uploadedFileStreamID, replacementFileStreamID}
_returns := &ZFileWillBeUploadedReturns{A: _args.B}
if err := g.client.Call("Plugin.FileWillBeUploaded", _args, _returns); err != nil {
g.log.Error("RPC call FileWillBeUploaded to plugin failed.", mlog.Err(err))
}
// Ensure the io.Copy from the replacementFileConnection above completes.
<-replacementDone
return _returns.A, _returns.B
}
func (s *hooksRPCServer) FileWillBeUploaded(args *ZFileWillBeUploadedArgs, returns *ZFileWillBeUploadedReturns) error {
uploadFileConnection, err := s.muxBroker.Dial(args.UploadedFileStream)
if err != nil {
fmt.Fprintf(os.Stderr, "[ERROR] Can't connect to remote upload file stream, error: %v", err.Error())
return err
}
defer uploadFileConnection.Close()
fileReader := connectIOReader(uploadFileConnection)
defer fileReader.Close()
replacementFileConnection, err := s.muxBroker.Dial(args.ReplacementFileStream)
if err != nil {
fmt.Fprintf(os.Stderr, "[ERROR] Can't connect to remote replacement file stream, error: %v", err.Error())
return err
}
defer replacementFileConnection.Close()
returnFileWriter := replacementFileConnection
if hook, ok := s.impl.(interface {
FileWillBeUploaded(c *Context, info *model.FileInfo, file io.Reader, output io.Writer) (*model.FileInfo, string)
}); ok {
returns.A, returns.B = hook.FileWillBeUploaded(args.A, args.B, fileReader, returnFileWriter)
} else {
return fmt.Errorf("hook FileWillBeUploaded called but not implemented")
}
return nil
}
// MessageWillBePosted is in this file because of the difficulty of identifying which fields need special behaviour.
// The special behaviour needed is decoding the returned post into the original one to avoid the unintentional removal
// of fields by older plugins.
func init() {
hookNameToId["MessageWillBePosted"] = MessageWillBePostedID
}
type ZMessageWillBePostedArgs struct {
A *Context
B *model.Post
}
type ZMessageWillBePostedReturns struct {
A *model.Post
B string
}
func (g *hooksRPCClient) MessageWillBePosted(c *Context, post *model.Post) (*model.Post, string) {
_args := &ZMessageWillBePostedArgs{c, post}
_returns := &ZMessageWillBePostedReturns{A: _args.B}
if g.implemented[MessageWillBePostedID] {
if err := g.client.Call("Plugin.MessageWillBePosted", _args, _returns); err != nil {
g.log.Error("RPC call MessageWillBePosted to plugin failed.", mlog.Err(err))
}
}
return _returns.A, _returns.B
}
func (s *hooksRPCServer) MessageWillBePosted(args *ZMessageWillBePostedArgs, returns *ZMessageWillBePostedReturns) error {
if hook, ok := s.impl.(interface {
MessageWillBePosted(c *Context, post *model.Post) (*model.Post, string)
}); ok {
returns.A, returns.B = hook.MessageWillBePosted(args.A, args.B)
} else {
return encodableError(fmt.Errorf("hook MessageWillBePosted called but not implemented"))
}
return nil
}
// MessageWillBeUpdated is in this file because of the difficulty of identifying which fields need special behaviour.
// The special behaviour needed is decoding the returned post into the original one to avoid the unintentional removal
// of fields by older plugins.
func init() {
hookNameToId["MessageWillBeUpdated"] = MessageWillBeUpdatedID
}
type ZMessageWillBeUpdatedArgs struct {
A *Context
B *model.Post
C *model.Post
}
type ZMessageWillBeUpdatedReturns struct {
A *model.Post
B string
}
func (g *hooksRPCClient) MessageWillBeUpdated(c *Context, newPost, oldPost *model.Post) (*model.Post, string) {
_args := &ZMessageWillBeUpdatedArgs{c, newPost, oldPost}
_returns := &ZMessageWillBeUpdatedReturns{A: _args.B}
if g.implemented[MessageWillBeUpdatedID] {
if err := g.client.Call("Plugin.MessageWillBeUpdated", _args, _returns); err != nil {
g.log.Error("RPC call MessageWillBeUpdated to plugin failed.", mlog.Err(err))
}
}
return _returns.A, _returns.B
}
func (s *hooksRPCServer) MessageWillBeUpdated(args *ZMessageWillBeUpdatedArgs, returns *ZMessageWillBeUpdatedReturns) error {
if hook, ok := s.impl.(interface {
MessageWillBeUpdated(c *Context, newPost, oldPost *model.Post) (*model.Post, string)
}); ok {
returns.A, returns.B = hook.MessageWillBeUpdated(args.A, args.B, args.C)
} else {
return encodableError(fmt.Errorf("hook MessageWillBeUpdated called but not implemented"))
}
return nil
}
type ZLogDebugArgs struct {
A string
B []interface{}
}
type ZLogDebugReturns struct {
}
func (g *apiRPCClient) LogDebug(msg string, keyValuePairs ...interface{}) {
stringifiedPairs := stringifyToObjects(keyValuePairs)
_args := &ZLogDebugArgs{msg, stringifiedPairs}
_returns := &ZLogDebugReturns{}
if err := g.client.Call("Plugin.LogDebug", _args, _returns); err != nil {
log.Printf("RPC call to LogDebug API failed: %s", err.Error())
}
}
func (s *apiRPCServer) LogDebug(args *ZLogDebugArgs, returns *ZLogDebugReturns) error {
if hook, ok := s.impl.(interface {
LogDebug(msg string, keyValuePairs ...interface{})
}); ok {
hook.LogDebug(args.A, args.B...)
} else {
return encodableError(fmt.Errorf("API LogDebug called but not implemented"))
}
return nil
}
type ZLogInfoArgs struct {
A string
B []interface{}
}
type ZLogInfoReturns struct {
}
func (g *apiRPCClient) LogInfo(msg string, keyValuePairs ...interface{}) {
stringifiedPairs := stringifyToObjects(keyValuePairs)
_args := &ZLogInfoArgs{msg, stringifiedPairs}
_returns := &ZLogInfoReturns{}
if err := g.client.Call("Plugin.LogInfo", _args, _returns); err != nil {
log.Printf("RPC call to LogInfo API failed: %s", err.Error())
}
}
func (s *apiRPCServer) LogInfo(args *ZLogInfoArgs, returns *ZLogInfoReturns) error {
if hook, ok := s.impl.(interface {
LogInfo(msg string, keyValuePairs ...interface{})
}); ok {
hook.LogInfo(args.A, args.B...)
} else {
return encodableError(fmt.Errorf("API LogInfo called but not implemented"))
}
return nil
}
type ZLogWarnArgs struct {
A string
B []interface{}
}
type ZLogWarnReturns struct {
}
func (g *apiRPCClient) LogWarn(msg string, keyValuePairs ...interface{}) {
stringifiedPairs := stringifyToObjects(keyValuePairs)
_args := &ZLogWarnArgs{msg, stringifiedPairs}
_returns := &ZLogWarnReturns{}
if err := g.client.Call("Plugin.LogWarn", _args, _returns); err != nil {
log.Printf("RPC call to LogWarn API failed: %s", err.Error())
}
}
func (s *apiRPCServer) LogWarn(args *ZLogWarnArgs, returns *ZLogWarnReturns) error {
if hook, ok := s.impl.(interface {
LogWarn(msg string, keyValuePairs ...interface{})
}); ok {
hook.LogWarn(args.A, args.B...)
} else {
return encodableError(fmt.Errorf("API LogWarn called but not implemented"))
}
return nil
}
type ZLogErrorArgs struct {
A string
B []interface{}
}
type ZLogErrorReturns struct {
}
func (g *apiRPCClient) LogError(msg string, keyValuePairs ...interface{}) {
stringifiedPairs := stringifyToObjects(keyValuePairs)
_args := &ZLogErrorArgs{msg, stringifiedPairs}
_returns := &ZLogErrorReturns{}
if err := g.client.Call("Plugin.LogError", _args, _returns); err != nil {
log.Printf("RPC call to LogError API failed: %s", err.Error())
}
}
func (s *apiRPCServer) LogError(args *ZLogErrorArgs, returns *ZLogErrorReturns) error {
if hook, ok := s.impl.(interface {
LogError(msg string, keyValuePairs ...interface{})
}); ok {
hook.LogError(args.A, args.B...)
} else {
return encodableError(fmt.Errorf("API LogError called but not implemented"))
}
return nil
}
type ZInstallPluginArgs struct {
PluginStreamID uint32
B bool
}
type ZInstallPluginReturns struct {
A *model.Manifest
B *model.AppError
}
func (g *apiRPCClient) InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *model.AppError) {
pluginStreamID := g.muxBroker.NextId()
go func() {
uploadPluginConnection, err := g.muxBroker.Accept(pluginStreamID)
if err != nil {
log.Print("Plugin failed to upload plugin. MuxBroker could not Accept connection", mlog.Err(err))
return
}
defer uploadPluginConnection.Close()
serveIOReader(file, uploadPluginConnection)
}()
_args := &ZInstallPluginArgs{pluginStreamID, replace}
_returns := &ZInstallPluginReturns{}
if err := g.client.Call("Plugin.InstallPlugin", _args, _returns); err != nil {
log.Print("RPC call InstallPlugin to plugin failed.", mlog.Err(err))
}
return _returns.A, _returns.B
}
func (s *apiRPCServer) InstallPlugin(args *ZInstallPluginArgs, returns *ZInstallPluginReturns) error {
hook, ok := s.impl.(interface {
InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *model.AppError)
})
if !ok {
return encodableError(fmt.Errorf("API InstallPlugin called but not implemented"))
}
receivePluginConnection, err := s.muxBroker.Dial(args.PluginStreamID)
if err != nil {
fmt.Fprintf(os.Stderr, "[ERROR] Can't connect to remote plugin stream, error: %v", err.Error())
return err
}
pluginReader := connectIOReader(receivePluginConnection)
defer pluginReader.Close()
returns.A, returns.B = hook.InstallPlugin(pluginReader, args.B)
return nil
}