plugins

package
v0.0.0-...-8680cc4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HandShakePath is the path for handshaking.
	HandShakePath = "/Plugin.Activate"
)

Variables

View Source
var ErrNotFound = errors.New("plugin not found")

ErrNotFound represents that the plugin is not found.

View Source
var ErrNotImplemented = errors.New("plugin not implement")

ErrNotImplemented represents that the plugin not implement the given protocol.

Functions

func SetPluginSockPaths

func SetPluginSockPaths(paths []string)

SetPluginSockPaths sets the plugin sock paths.

func SetPluginSpecPaths

func SetPluginSpecPaths(paths []string)

SetPluginSpecPaths sets the plugin spec paths.

Types

type ErrPluginStatus

type ErrPluginStatus struct {
	StatusCode int
	Message    string
}

ErrPluginStatus represents that the plugin status error.

func (*ErrPluginStatus) Error

func (e *ErrPluginStatus) Error() string

Error returns the error message.

type HandShakeResp

type HandShakeResp struct {
	Implements []string `json:"Implements"`
}

HandShakeResp is a handshake response.

type Plugin

type Plugin struct {
	sync.Mutex

	// Name is the plugin name.
	Name string `json:"Name"`

	// Addr is the plugin address.
	Addr string `json:"Addr"`

	// TLSConfig is the tls config.
	TLSConfig *TLSConfig `json:"TLSConfig"`

	// Implements is the plugin implement infos.
	Implements []string `json:"-"`
	// contains filtered or unexported fields
}

Plugin includes the Name, Addr, TLSConfig.

func Get

func Get(pluginType, name string) (*Plugin, error)

Get returns the requested plugin.

func GetAll

func GetAll(pluginType string) ([]*Plugin, error)

GetAll returns all the plugins which implement the pluginType.

func (*Plugin) Client

func (p *Plugin) Client() *PluginClient

Client returns the plugin client

type PluginClient

type PluginClient struct {
	// contains filtered or unexported fields
}

PluginClient is the plugin client.

func NewPluginClient

func NewPluginClient(addr string, tlsconfig *TLSConfig) (*PluginClient, error)

NewPluginClient creates a PluginClient from the address and tls config.

func (*PluginClient) CallService

func (cli *PluginClient) CallService(service string, in, out interface{}, retry bool) error

CallService calls the service provided by plugin server.

type TLSConfig

type TLSConfig struct {
	CAFile             string `json:"CAFile"`
	CertFile           string `json:"CertFile"`
	KeyFile            string `json:"KeyFile"`
	InsecureSkipVerify bool   `json:"InsecureSkipVerify"`
}

TLSConfig contains tls info which users can specify.

Jump to

Keyboard shortcuts

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