kaetzchen

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2018 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package kaetzchen implements support for provider side auto-responder agents.

Package kaetzchen implements support for provider side auto-responder agents.

Index

Constants

View Source
const LoopCapability = "loop"

LoopCapability is the standardized capability for the loop/discard service.

View Source
const ParameterEndpoint = "endpoint"

ParameterEndpoint is the mandatory Parameter key indicationg the Kaetzchen's endpoint.

Variables

View Source
var BuiltInCtors = map[string]BuiltInCtorFn{
	LoopCapability: NewLoop,
	// contains filtered or unexported fields
}

BuiltInCtors are the constructors for all built-in Kaetzchen.

View Source
var ErrNoResponse = errors.New("kaetzchen: message has no response")

ErrNoResponse is the error returned from OnMessage() when there is no response to be sent (rather than an empty response).

Functions

This section is empty.

Types

type BuiltInCtorFn

type BuiltInCtorFn func(*config.Kaetzchen, glue.Glue) (Kaetzchen, error)

BuiltInCtorFn is the constructor type for a built-in Kaetzchen.

type Kaetzchen

type Kaetzchen interface {
	// 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.
	Parameters() Parameters

	// OnRequest is the method that is called when the Provider receives
	// a request desgined for a particular agent.  The caller will handle
	// extracting the payload component of the message.
	//
	// Implementations MUST:
	//
	//  * Be thread (go routine) safe.
	//
	//  * Return ErrNoResponse if there is no response to be sent.  A nil
	//    byte slice and nil error will result in a response with a 0 byte
	//    payload being sent.
	//
	//  * NOT assume payload will be valid past the call to OnMessage.
	//    Any contents that need to be preserved, MUST be copied out,
	//    except if it is only used as a part of the response body.
	OnRequest(id uint64, payload []byte, hasSURB bool) ([]byte, error)

	// Halt cleans up the agent prior to de-registration and teardown.
	Halt()
}

Kaetzchen is the interface implemented by each auto-responder agent.

func NewKeyserver

func NewKeyserver(cfg *config.Kaetzchen, glue glue.Glue) (Kaetzchen, error)

NewKeyserver constructs a new Keyserver Kaetzchen instance, providing the "keyserver" capability on the configured endpoint.

func NewLoop

func NewLoop(cfg *config.Kaetzchen, glue glue.Glue) (Kaetzchen, error)

NewLoop constructs a new Loop Kaetzchen instance, providing the "loop" capability, on the configured endpoint.

type KaetzchenWorker added in v0.0.2

type KaetzchenWorker struct {
	sync.Mutex
	worker.Worker
	// contains filtered or unexported fields
}

func New added in v0.0.2

func New(glue glue.Glue) (*KaetzchenWorker, error)

func (*KaetzchenWorker) IsKaetzchen added in v0.0.2

func (k *KaetzchenWorker) IsKaetzchen(recipient [sConstants.RecipientIDLength]byte) bool

func (*KaetzchenWorker) KaetzchenForPKI added in v0.0.2

func (k *KaetzchenWorker) KaetzchenForPKI() map[string]map[string]interface{}

func (*KaetzchenWorker) OnKaetzchen added in v0.0.2

func (k *KaetzchenWorker) OnKaetzchen(pkt *packet.Packet)

type Parameters

type Parameters map[string]interface{}

Parameters is the map describing each Kaetzchen's parameters to be published in the Provider's descriptor.

type PluginKaetzchenWorker added in v0.0.3

type PluginKaetzchenWorker struct {
	sync.Mutex
	worker.Worker
	// contains filtered or unexported fields
}

PluginKaetzchenWorker is similar to Kaetzchen worker but uses the go-plugin system to implement services in external programs. These plugins can be written in any language as long as it speaks gRPC over unix domain socket.

func NewPluginKaetzchenWorker added in v0.0.3

func NewPluginKaetzchenWorker(glue glue.Glue) (*PluginKaetzchenWorker, error)

NewPluginKaetzchenWorker returns a new PluginKaetzchenWorker

func (*PluginKaetzchenWorker) IsKaetzchen added in v0.0.3

func (k *PluginKaetzchenWorker) IsKaetzchen(recipient [sConstants.RecipientIDLength]byte) bool

IsKaetzchen returns true if the given recipient is one of our workers.

func (*PluginKaetzchenWorker) KaetzchenForPKI added in v0.0.3

func (k *PluginKaetzchenWorker) KaetzchenForPKI() map[string]map[string]interface{}

KaetzchenForPKI returns the plugins Parameters map for publication in the PKI doc.

func (*PluginKaetzchenWorker) OnKaetzchen added in v0.0.3

func (k *PluginKaetzchenWorker) OnKaetzchen(pkt *packet.Packet)

OnKaetzchen enqueues the pkt for processing by our thread pool of plugins.

Jump to

Keyboard shortcuts

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