Documentation ¶
Index ¶
- Constants
- Variables
- func HandleEnvelopeSubscription(sub EnvelopeSubscription, handler func(*Envelope) error)
- func ListenOnExternalPort(c *listenConfig)
- func ListenOnIPV6(c *listenConfig)
- func ListenOnLocalIPs(c *listenConfig)
- func ListenOnPrivateIPs(c *listenConfig)
- func WithLocalPeer(k localpeer.LocalPeer) func(*network)
- type DataForward
- type Envelope
- type EnvelopeFilter
- type EnvelopePubSub
- type EnvelopeSubscription
- type ListenOption
- type MockEnvelopeSubscription
- type Network
- type Option
- type OutboxesMap
- func (m *OutboxesMap) Delete(k crypto.PublicKey)
- func (m *OutboxesMap) Get(k crypto.PublicKey) (*outbox, bool)
- func (m *OutboxesMap) GetOrPut(k crypto.PublicKey, v *outbox) (*outbox, bool)
- func (m *OutboxesMap) ListKeys() []crypto.PublicKey
- func (m *OutboxesMap) ListValues() []*outbox
- func (m *OutboxesMap) Put(k crypto.PublicKey, v *outbox)
- func (m *OutboxesMap) Range(i func(k crypto.PublicKey, v *outbox) bool)
Constants ¶
View Source
const ( // ErrInvalidRequest when received an invalid request object ErrInvalidRequest = errors.Error("invalid request") // ErrSendingTimedOut when sending times out ErrSendingTimedOut = errors.Error("sending timed out") // ErrAlreadySentDuringContext when trying to send to the same peer during // this context ErrAlreadySentDuringContext = errors.Error("already sent to peer") )
Variables ¶
View Source
var ( // ErrNotFound is returned by Get() when the object was not found ErrNotFound = errors.New("not found") // ErrCannotSendToSelf is returned when trying to Send() to our own peer ErrCannotSendToSelf = errors.New("cannot send objects to ourself") )
Functions ¶
func HandleEnvelopeSubscription ¶
func HandleEnvelopeSubscription( sub EnvelopeSubscription, handler func(*Envelope) error, )
func ListenOnExternalPort ¶
func ListenOnExternalPort(c *listenConfig)
func ListenOnIPV6 ¶
func ListenOnIPV6(c *listenConfig)
func ListenOnLocalIPs ¶
func ListenOnLocalIPs(c *listenConfig)
func ListenOnPrivateIPs ¶
func ListenOnPrivateIPs(c *listenConfig)
func WithLocalPeer ¶
WithLocalPeer overrides the default localpeer for the network.
Types ¶
type DataForward ¶
type DataForward struct { Metadata object.Metadata `nimona:"metadata:m,omitempty"` Recipient crypto.PublicKey `nimona:"recipient:s,omitempty"` Ephermeral crypto.PublicKey `nimona:"ephermeral:s,omitempty"` Data []byte `nimona:"data:d,omitempty"` }
func (*DataForward) FromObject ¶
func (e *DataForward) FromObject(o *object.Object) error
func (DataForward) ToObject ¶
func (e DataForward) ToObject() *object.Object
func (*DataForward) Type ¶ added in v0.12.0
func (e *DataForward) Type() string
type EnvelopeFilter ¶
func FilterByNonce ¶
func FilterByNonce(nonce string) EnvelopeFilter
func FilterByObjectHash ¶
func FilterByObjectHash(objectHashes ...object.Hash) EnvelopeFilter
func FilterByObjectType ¶
func FilterByObjectType(typePatterns ...string) EnvelopeFilter
func FilterBySender ¶
func FilterBySender(keys ...crypto.PublicKey) EnvelopeFilter
type EnvelopePubSub ¶
type EnvelopePubSub interface { Publish(*Envelope) Subscribe(...EnvelopeFilter) EnvelopeSubscription }
EnvelopePubSub -
func NewEnvelopePubSub ¶
func NewEnvelopePubSub() EnvelopePubSub
NewEnvelope constructs and returns a new Envelope
type EnvelopeSubscription ¶
EnvelopeSubscription is returned for every subscription
type ListenOption ¶
type ListenOption func(c *listenConfig)
type MockEnvelopeSubscription ¶
type MockEnvelopeSubscription struct {
// contains filtered or unexported fields
}
func (*MockEnvelopeSubscription) AddNext ¶
func (s *MockEnvelopeSubscription) AddNext(env *Envelope, err error)
func (*MockEnvelopeSubscription) Cancel ¶
func (s *MockEnvelopeSubscription) Cancel()
func (*MockEnvelopeSubscription) Next ¶
func (s *MockEnvelopeSubscription) Next() (*Envelope, error)
type Network ¶
type Network interface { Subscribe( filters ...EnvelopeFilter, ) EnvelopeSubscription Send( ctx context.Context, object *object.Object, recipient *peer.ConnectionInfo, ) error Listen( ctx context.Context, bindAddress string, options ...ListenOption, ) (net.Listener, error) LocalPeer() localpeer.LocalPeer }
Network interface for mocking
type OutboxesMap ¶
type OutboxesMap struct {
// contains filtered or unexported fields
}
OutboxesMap -
Click to show internal directories.
Click to hide internal directories.