psser

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package psser exposes functionalities needed to communicate with other peers on the network. Pss uses pushsync and pullsync for message delivery and mailboxing. All messages are disguised as content-addressed chunks. Sending and receiving of messages is exposed over the HTTP API, with websocket subscriptions for incoming messages.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoHandler = errors.New("no handler found")
)

Functions

This section is empty.

Types

type Handler

type Handler func(context.Context, []byte)

Handler defines code to be executed upon reception of a trojan message.

type Interface

type Interface interface {
	Sender
	// Register a Handler for a given Topic.
	Register(trojan.Topic, Handler) func()
	// TryUnwrap tries to unwrap a wrapped trojan message.
	TryUnwrap(cluster.Chunk)

	SetPushSyncer(pushSyncer pushsync.PushSyncer)
	io.Closer
}

func New

func New(key *ecdsa.PrivateKey, logger log.Logger) Interface

New returns a new psser service.

type Sender

type Sender interface {
	// Send arbitrary byte slice with the given topic to Targets.
	Send(context.Context, trojan.Topic, []byte, voucher.Stamper, *ecdsa.PublicKey, trojan.Targets) error
}

Jump to

Keyboard shortcuts

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