Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Serve ¶
func Serve(pl Plugin)
Server starts the plugin, it should be called in the main() function. The following environment variables are required when using this function:
MagicCookieKey and value are used as a very basic verification that a plugin is intended to be launched. This is not a security measure, just a UX feature. If the magic cookie doesn't match, we show human-friendly output.
* MAGIC_COOKIE_KEY * MAGIC_COOKIE_VAL * PLUGIN_NAME * PLUGIN_VERSION (uint)
Serve will panic for unexpected conditions where a user's fix is unknown.
Types ¶
type Plugin ¶
type Plugin interface { // OnSessionOpen phase will initialize the configuration in memory // that could be used to other phases. The response will be used to mutate // the session params received. // Return an error in case any pre-condition doesn't match OnSessionOpen(*SesssionParams, *SessionParamsResponse) error // OnReceive phase process each received packet // the response object should be used to mutate the request packet or // returning an error and stopping processing further packets OnReceive(*Request, *Response) error // OnSend phase will trigger when a packet will be sent // to the client. The request will contain the packet and type // and the response could mutate the payload or return an error // if a condiction is not met. OnSend(*Request, *Response) error }
type RPCPluginMethod ¶
type RPCPluginMethod string
RPCPluginMethod is the name of the RPC method to be called. It must match exactly the name of methods in the Plugin interface
const ( RPCPluginMethodOnSessionOpen RPCPluginMethod = "OnSessionOpen" RPCPluginMethodOnReceive RPCPluginMethod = "OnReceive" RPCPluginMethodOnSend RPCPluginMethod = "OnSend" )
type SessionParamsResponse ¶ added in v0.0.6
type SesssionParams ¶ added in v0.0.6
Click to show internal directories.
Click to hide internal directories.