plugin

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register added in v1.0.2

func Register(protocol string, p IPlugin)

func Setup

func Setup(plugins map[string]string) error

Types

type IPlugin added in v1.0.2

type IPlugin interface {
	// Setup calls at the begin of plugin system initialize
	// plugin system will pass the raw message to plugin's Setup function
	Setup(json.RawMessage) error

	// Close a proxy, it may be called by client's connection close
	StopProxy(item *PluginMeta)

	// Run a proxy, it may be called by client's connection established
	RunProxy(item *PluginMeta) error
}

IPlugin defines plugin interface Plugin should implements the IPlugin

type PluginManager added in v1.0.2

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

func DefaultPluginManager added in v1.0.2

func DefaultPluginManager() *PluginManager

func (*PluginManager) AddProxy added in v1.0.2

func (p *PluginManager) AddProxy(item *PluginMeta) error

func (*PluginManager) DelProxy added in v1.0.2

func (p *PluginManager) DelProxy(item *PluginMeta)

type PluginMeta added in v1.0.2

type PluginMeta struct {
	// plugin register protocol
	// eg: tcp, udp, http, http2, h2c
	Protocol string

	// From specific local listener address of plugin
	// browser or other clients will connect to this address
	// it's no use for restyproxy plugin.
	From string

	// To specific VIP:port of our VPN peer node.
	// For example:
	// our VPN virtual lan cidr is 100.64.100.1/24
	// the connected VPN client's VPN lan ip is 100.64.100.10/24
	// and it wants to export 8080 as http port, so the $To is
	// 100.64.100.10:8080
	To string

	// Domain specific the domain of our VPN peer node.
	// It could be empty
	Domain string

	// Data you want to passto plugin
	// Reserve
	Ctx           interface{}
	RecycleSignal chan struct{}
}

PluginMeta defineds data that the plugins needs these members are filled by server.go

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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