Documentation
¶
Overview ¶
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 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/katzenpost/blob/master/docs/specs/kaetzchen.rst
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func NewClient ¶
func NewClient(logBackend *log.Backend, capability, endpoint string, commandBuilder CommandBuilder) *Client
func (*Client) Capability ¶
func (*Client) GetParameters ¶
type ClientPlugin ¶
type CommandBuilder ¶
type CommandBuilder interface {
Build() Command
}
type CommandIO ¶
func NewCommandIO ¶
type Parameters ¶
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/katzenpost/blob/master/core/pki/pki.go
type Request ¶
type Request struct {
// RequestAt is the time when the Request corresponding to this Response was received
RequestAt time.Time
// Delay is the amount of time that the Response should be delayed before transmission
Delay time.Duration // the Delay specififed for this hop
// ID is the Request's packet ID
ID uint64
// Payload is the encrypted Request
Payload []byte
// SURB is the routing header used to return the Response to the requesting client
SURB []byte
// IsParametersRequest signals this is a request for plugin parameters,
// not a regular service request. Old plugins ignore this field.
IsParametersRequest bool `cbor:",omitempty"`
}
Request is the struct type used in service query requests to plugins. This struct is backwards compatible - it contains the original fields at the top level, plus optional new fields for parameter requests. Old plugins will ignore the new fields (cbor omitempty). New plugins can check IsParametersRequest to handle parameter queries.
func NewParametersRequest ¶ added in v0.0.72
func NewParametersRequest() *Request
NewParametersRequest creates a Request that asks the plugin for its dynamic parameters. Old plugins will ignore the IsParametersRequest field and may return an empty or error response. New plugins should check IsParametersRequest and respond with a Response where IsParametersResponse=true and Params is populated.
type RequestFactory ¶
type RequestFactory struct {
}
RequestFactory is a CommandBuilder for Requests
type Response ¶
type Response struct {
// RequestAt is the time when the Request corresponding to this Response was received
RequestAt time.Time
// Delay is the amount of time that the Response should be delayed before transmission
Delay time.Duration
// ID is the Request's packet ID
ID uint64
// Payload is the encrypted response
Payload []byte
// SURB is the routing header used to return the Response to the requesting client
SURB []byte
// IsParametersResponse signals this is a response containing plugin parameters,
// not a regular service response. Old plugins never set this field.
IsParametersResponse bool `cbor:",omitempty"`
// Params contains dynamic parameters from the plugin when IsParametersResponse is true.
// This is used for plugin-advertised data in the mix descriptor.
Params map[string]interface{} `cbor:",omitempty"`
}
Response is the response received after sending a Request to the plugin. This struct is backwards compatible - it contains the original fields at the top level, plus optional new fields for parameter responses. Old plugins send responses without the new fields. New plugins can set IsParametersResponse and Params for dynamic parameters.
func NewParametersResponse ¶ added in v0.0.72
NewParametersResponse creates a Response containing dynamic plugin parameters. This is used by new plugins to advertise dynamic data to the mix descriptor.
func (*Response) IsRegularResponse ¶ added in v0.0.72
IsRegularResponse returns true if this is a regular service response (not a parameters response). Used to distinguish response types.
type ResponseFactory ¶
type ResponseFactory struct {
}
ResponseFactory is a CommandBuilder for Responses
type Server ¶
Server is used to construct plugins, which are programs which listen on a unix domain socket for connections from the Provider/mix server.
func NewServer ¶
func NewServer(log *logging.Logger, socketFile string, commandBuilder CommandBuilder, plugin ServerPlugin) *Server
type ServerPlugin ¶
type ServicePlugin ¶
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)
// Capability returns the agent's functionality for publication in
// the Provider's descriptor.
Capability() string
// 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/katzenpost/server/internal/provider/kaetzchen/kaetzchen.go