server: github.com/katzenpost/server/cborplugin Index | Files

package cborplugin

import "github.com/katzenpost/server/cborplugin"

Package cborplugin is a plugin system allowing mix network services to be added in any language. It communicates queries and responses to and from the mix server using CBOR over HTTP over UNIX domain socket. Beyond that, a client supplied SURB is used to route the response back to the client as described in our Kaetzchen specification document:

https://github.com/katzenpost/docs/blob/master/specs/kaetzchen.rst

Index

Package Files

client.go

type Client Uses

type Client struct {
    worker.Worker
    // contains filtered or unexported fields
}

Client acts as a client interacting with one or more plugins. The Client type is composite with Worker and therefore has a Halt method. Client implements this interface and proxies data between this mix server and the external plugin program.

func New Uses

func New(command string, logBackend *log.Backend) *Client

New creates a new plugin client instance which represents the single execution of the external plugin program.

func (*Client) GetParameters Uses

func (c *Client) GetParameters() *Parameters

GetParameters are used in Mix Descriptor publication to give service clients more information about the service. Not plugins will need to use this feature.

func (*Client) OnRequest Uses

func (c *Client) OnRequest(request *Request) ([]byte, error)

OnRequest send a query request to plugin using CBOR + HTTP over Unix domain socket.

func (*Client) Start Uses

func (c *Client) Start(command string, args []string) error

Start execs the plugin and starts a worker thread to listen on the halt chan sends a TERM signal to the plugin if the shutdown even is dispatched.

type Parameters Uses

type Parameters map[string]string

Parameters is an optional mapping that plugins can publish, these get advertised to clients in the MixDescriptor. The output of GetParameters() ends up being published in a map associating with the service names to service parameters map. This information is part of the Mix Descriptor which is defined here: https://github.com/katzenpost/core/blob/master/pki/pki.go

type Request Uses

type Request struct {
    ID      uint64
    Payload []byte
    HasSURB bool
}

Request is the struct type used in service query requests to plugins.

type Response Uses

type Response struct {
    Payload []byte
}

Response is the response received after sending a Request to the plugin.

type ServicePlugin Uses

type ServicePlugin interface {
    // OnRequest is the method that is called when the Provider receives
    // a request designed for a particular agent. The caller will handle
    // extracting the payload component of the message
    OnRequest(request *Request) ([]byte, error)

    // Parameters returns the agent's paramenters for publication in
    // the Provider's descriptor.
    GetParameters() *Parameters

    // Halt stops the plugin.
    Halt()
}

ServicePlugin is the interface that we expose for external plugins to implement. This is similar to the internal Kaetzchen interface defined in: github.com/katzenpost/server/internal/provider/kaetzchen/kaetzchen.go

Package cborplugin imports 12 packages (graph) and is imported by 2 packages. Updated 2019-09-17. Refresh now. Tools for package owners.