Documentation ¶
Index ¶
- Constants
- 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 SendWithConnectionInfo(c *peer.ConnectionInfo) func(*sendOptions)
- func SendWithResponse(v interface{ ... }, t time.Duration) func(*sendOptions)
- func WithLocalPeer(k localpeer.LocalPeer) func(*network)
- type DataForwardEnvelope
- func (e *DataForwardEnvelope) FromObject(o *object.Object) error
- func (e *DataForwardEnvelope) MarshalMap() (object.Map, error)
- func (e *DataForwardEnvelope) MarshalObject() (*object.Object, error)
- func (e DataForwardEnvelope) ToObject() *object.Object
- func (e *DataForwardEnvelope) Type() string
- func (e *DataForwardEnvelope) UnmarshalMap(m object.Map) error
- func (e *DataForwardEnvelope) UnmarshalObject(o *object.Object) error
- type DataForwardRequest
- func (e *DataForwardRequest) FromObject(o *object.Object) error
- func (e *DataForwardRequest) MarshalMap() (object.Map, error)
- func (e *DataForwardRequest) MarshalObject() (*object.Object, error)
- func (e DataForwardRequest) ToObject() *object.Object
- func (e *DataForwardRequest) Type() string
- func (e *DataForwardRequest) UnmarshalMap(m object.Map) error
- func (e *DataForwardRequest) UnmarshalObject(o *object.Object) error
- type DataForwardResponse
- func (e *DataForwardResponse) FromObject(o *object.Object) error
- func (e *DataForwardResponse) MarshalMap() (object.Map, error)
- func (e *DataForwardResponse) MarshalObject() (*object.Object, error)
- func (e DataForwardResponse) ToObject() *object.Object
- func (e *DataForwardResponse) Type() string
- func (e *DataForwardResponse) UnmarshalMap(m object.Map) error
- func (e *DataForwardResponse) UnmarshalObject(o *object.Object) error
- type Envelope
- type EnvelopeFilter
- type EnvelopePubSub
- type EnvelopeSubscription
- type ListenOption
- type MockEnvelopeSubscription
- type Network
- type Option
- type OutboxesMap
- func (m *OutboxesMap) Delete(k string)
- func (m *OutboxesMap) Get(k string) (*outbox, bool)
- func (m *OutboxesMap) GetOrPut(k string, v *outbox) (*outbox, bool)
- func (m *OutboxesMap) ListKeys() []string
- func (m *OutboxesMap) ListValues() []*outbox
- func (m *OutboxesMap) Put(k string, v *outbox)
- func (m *OutboxesMap) Range(i func(k string, v *outbox) bool)
- type Resolver
- type ResolverSyncList
- type SendOption
Constants ¶
View Source
const ( // ErrNotFound is returned by Get() when the object was not found ErrNotFound = errors.Error("not found") // ErrCannotSendToSelf is returned when trying to Send() to our own peer ErrCannotSendToSelf = errors.Error("cannot send objects to ourself") // 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") // ErrWaitingForResponseTimedOut is returned when Send is waiting for a // response given a response id ErrWaitingForResponseTimedOut = errors.Error("time out waiting for response") // ErrUnableToUnmarshalIntoResponse is returned when the returned object // cannot be unmarshalled into given struct ErrUnableToUnmarshalIntoResponse = errors.Error("unable to unmarshal into" + " given response") )
Variables ¶
This section is empty.
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 SendWithConnectionInfo ¶ added in v0.15.5
func SendWithConnectionInfo(c *peer.ConnectionInfo) func(*sendOptions)
func SendWithResponse ¶ added in v0.15.5
func WithLocalPeer ¶
WithLocalPeer overrides the default localpeer for the network.
Types ¶
type DataForwardEnvelope ¶ added in v0.15.0
func (*DataForwardEnvelope) FromObject ¶ added in v0.15.0
func (e *DataForwardEnvelope) FromObject(o *object.Object) error
func (*DataForwardEnvelope) MarshalMap ¶ added in v0.18.0
func (e *DataForwardEnvelope) MarshalMap() (object.Map, error)
func (*DataForwardEnvelope) MarshalObject ¶ added in v0.18.0
func (e *DataForwardEnvelope) MarshalObject() (*object.Object, error)
func (DataForwardEnvelope) ToObject ¶ added in v0.15.0
func (e DataForwardEnvelope) ToObject() *object.Object
func (*DataForwardEnvelope) Type ¶ added in v0.15.0
func (e *DataForwardEnvelope) Type() string
func (*DataForwardEnvelope) UnmarshalMap ¶ added in v0.18.0
func (e *DataForwardEnvelope) UnmarshalMap(m object.Map) error
func (*DataForwardEnvelope) UnmarshalObject ¶ added in v0.18.0
func (e *DataForwardEnvelope) UnmarshalObject(o *object.Object) error
type DataForwardRequest ¶ added in v0.15.0
type DataForwardRequest struct { Metadata object.Metadata RequestID string Recipient crypto.PublicKey Payload *object.Object }
func (*DataForwardRequest) FromObject ¶ added in v0.15.0
func (e *DataForwardRequest) FromObject(o *object.Object) error
func (*DataForwardRequest) MarshalMap ¶ added in v0.18.0
func (e *DataForwardRequest) MarshalMap() (object.Map, error)
func (*DataForwardRequest) MarshalObject ¶ added in v0.18.0
func (e *DataForwardRequest) MarshalObject() (*object.Object, error)
func (DataForwardRequest) ToObject ¶ added in v0.15.0
func (e DataForwardRequest) ToObject() *object.Object
func (*DataForwardRequest) Type ¶ added in v0.15.0
func (e *DataForwardRequest) Type() string
func (*DataForwardRequest) UnmarshalMap ¶ added in v0.18.0
func (e *DataForwardRequest) UnmarshalMap(m object.Map) error
func (*DataForwardRequest) UnmarshalObject ¶ added in v0.18.0
func (e *DataForwardRequest) UnmarshalObject(o *object.Object) error
type DataForwardResponse ¶ added in v0.15.0
func (*DataForwardResponse) FromObject ¶ added in v0.15.0
func (e *DataForwardResponse) FromObject(o *object.Object) error
func (*DataForwardResponse) MarshalMap ¶ added in v0.18.0
func (e *DataForwardResponse) MarshalMap() (object.Map, error)
func (*DataForwardResponse) MarshalObject ¶ added in v0.18.0
func (e *DataForwardResponse) MarshalObject() (*object.Object, error)
func (DataForwardResponse) ToObject ¶ added in v0.15.0
func (e DataForwardResponse) ToObject() *object.Object
func (*DataForwardResponse) Type ¶ added in v0.15.0
func (e *DataForwardResponse) Type() string
func (*DataForwardResponse) UnmarshalMap ¶ added in v0.18.0
func (e *DataForwardResponse) UnmarshalMap(m object.Map) error
func (*DataForwardResponse) UnmarshalObject ¶ added in v0.18.0
func (e *DataForwardResponse) UnmarshalObject(o *object.Object) error
type EnvelopeFilter ¶
func FilterByObjectCID ¶ added in v0.17.0
func FilterByObjectCID(objectCIDs ...object.CID) EnvelopeFilter
func FilterByObjectType ¶
func FilterByObjectType(typePatterns ...string) EnvelopeFilter
func FilterByRequestID ¶ added in v0.15.0
func FilterByRequestID(requestID string) 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 ¶
type EnvelopeSubscription interface { Channel() <-chan *Envelope Next() (*Envelope, error) Cancel() }
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, publicKey crypto.PublicKey, sendOptions ...SendOption, ) error Listen( ctx context.Context, bindAddress string, options ...ListenOption, ) (net.Listener, error) LocalPeer() localpeer.LocalPeer RegisterResolver( resolver Resolver, ) }
Network interface for mocking
type OutboxesMap ¶
type OutboxesMap struct {
// contains filtered or unexported fields
}
OutboxesMap -
func (*OutboxesMap) GetOrPut ¶
func (m *OutboxesMap) GetOrPut(k string, v *outbox) (*outbox, bool)
GetOrPut -
type ResolverSyncList ¶ added in v0.15.5
type ResolverSyncList struct {
// contains filtered or unexported fields
}
ResolverSyncList -
func (*ResolverSyncList) Delete ¶ added in v0.15.5
func (m *ResolverSyncList) Delete(k Resolver)
Delete -
func (*ResolverSyncList) Exists ¶ added in v0.15.5
func (m *ResolverSyncList) Exists(k Resolver) bool
Exists -
func (*ResolverSyncList) List ¶ added in v0.15.5
func (m *ResolverSyncList) List() []Resolver
List -
func (*ResolverSyncList) Range ¶ added in v0.15.5
func (m *ResolverSyncList) Range(i func(k Resolver) bool)
Range -
type SendOption ¶ added in v0.15.5
type SendOption func(*sendOptions)
SendOption for customizing a Send method
Click to show internal directories.
Click to hide internal directories.