Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDialTimeout ¶
SetDialTimeout sets the dial timeout
Types ¶
type ChannelDeMultiplexer ¶
type ChannelDeMultiplexer struct {
// contains filtered or unexported fields
}
ChannelDeMultiplexer is a struct that can receive channel registrations (AddChannel) and publications (DeMultiplex) and it broadcasts the publications to registrations according to their predicate
func NewChannelDemultiplexer ¶
func NewChannelDemultiplexer() *ChannelDeMultiplexer
NewChannelDemultiplexer creates a new ChannelDeMultiplexer
func (*ChannelDeMultiplexer) AddChannel ¶
func (m *ChannelDeMultiplexer) AddChannel(predicate common.MessageAcceptor) chan interface{}
AddChannel registers a channel with a certain predicate
func (*ChannelDeMultiplexer) Close ¶
func (m *ChannelDeMultiplexer) Close()
Close closes this channel, which makes all channels registered before to close as well.
func (*ChannelDeMultiplexer) DeMultiplex ¶
func (m *ChannelDeMultiplexer) DeMultiplex(msg interface{})
DeMultiplex broadcasts the message to all channels that were returned by AddChannel calls and that hold the respected predicates.
type Comm ¶
type Comm interface { // GetPKIid returns this instance's PKI id GetPKIid() common.PKIidType // Send sends a message to remote peers Send(msg *proto.GossipMessage, peers ...*RemotePeer) // Probe probes a remote node and returns nil if its responsive Probe(peer *RemotePeer) error // Accept returns a dedicated read-only channel for messages sent by other nodes that match a certain predicate. // Each message from the channel can be used to send a reply back to the sender Accept(common.MessageAcceptor) <-chan ReceivedMessage // PresumedDead returns a read-only channel for node endpoints that are suspected to be offline PresumedDead() <-chan common.PKIidType // CloseConn closes a connection to a certain endpoint CloseConn(peer *RemotePeer) // Stop stops the module Stop() // BlackListPKIid prohibits the module communicating with the given PKIid BlackListPKIid(PKIid common.PKIidType) }
Comm is an object that enables to communicate with other peers that also embed a CommModule.
func NewCommInstance ¶
func NewCommInstance(s *grpc.Server, cert *tls.Certificate, idStore identity.Mapper, peerIdentity api.PeerIdentityType, dialOpts ...grpc.DialOption) (Comm, error)
NewCommInstance creates a new comm instance that binds itself to the given gRPC server
func NewCommInstanceWithServer ¶
func NewCommInstanceWithServer(port int, idMapper identity.Mapper, peerIdentity api.PeerIdentityType, dialOpts ...grpc.DialOption) (Comm, error)
NewCommInstanceWithServer creates a comm instance that creates an underlying gRPC server
type ReceivedMessage ¶
type ReceivedMessage interface { // Respond sends a GossipMessage to the origin from which this ReceivedMessage was sent from Respond(msg *proto.GossipMessage) // GetGossipMessage returns the underlying GossipMessage GetGossipMessage() *proto.GossipMessage // GetPKIID returns the PKI-ID of the remote peer // that sent the message GetPKIID() common.PKIidType }
ReceivedMessage is a GossipMessage wrapper that enables the user to send a message to the origin from which the ReceivedMessage was sent from. It also allows to know the identity of the sender
type ReceivedMessageImpl ¶
type ReceivedMessageImpl struct { *proto.GossipMessage // contains filtered or unexported fields }
ReceivedMessageImpl is an implementation of ReceivedMessage
func (*ReceivedMessageImpl) GetGossipMessage ¶
func (m *ReceivedMessageImpl) GetGossipMessage() *proto.GossipMessage
GetGossipMessage returns the inner GossipMessage
func (*ReceivedMessageImpl) GetPKIID ¶
func (m *ReceivedMessageImpl) GetPKIID() common.PKIidType
GetPKIID returns the PKI-ID of the remote peer that sent the message
func (*ReceivedMessageImpl) Respond ¶
func (m *ReceivedMessageImpl) Respond(msg *proto.GossipMessage)
Respond sends a msg to the source that sent the ReceivedMessageImpl
type RemotePeer ¶
RemotePeer defines a peer's endpoint and its PKIid
func (*RemotePeer) String ¶
func (p *RemotePeer) String() string
String converts a RemotePeer to a string