shared

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginName            = "debugtalk"
	GoPluginFile          = PluginName + ".so"  // built from go plugin
	HashicorpGoPluginFile = PluginName + ".bin" // built from hashicorp go plugin
	HashicorpPyPluginFile = PluginName + ".py"
)
View Source
const PluginTypeEnvName = "HRP_PLUGIN_TYPE"

PluginTypeEnvName is used to specify hashicorp go plugin type, rpc/grpc

Variables

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

HandshakeConfig is used to just do a basic handshake between a plugin and host. If the handshake fails, a user friendly error is shown. This prevents users from executing bad plugins or executing a plugin directory. It is a UX feature, not a security feature.

Functions

func CallFunc

func CallFunc(fn reflect.Value, args ...interface{}) (interface{}, error)

CallFunc calls function with arguments

func LocateFile

func LocateFile(startPath string, destFile string) (string, error)

LocateFile searches destFile upward recursively until current working directory or system root dir.

Types

type IFuncCaller

type IFuncCaller interface {
	GetNames() ([]string, error)                                    // get all plugin function names list
	Call(funcName string, args ...interface{}) (interface{}, error) // call plugin function
}

IFuncCaller is the interface that we're exposing as a plugin.

Jump to

Keyboard shortcuts

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