Documentation ¶
Index ¶
- func (m *GossipMessage) GetPullMsgType() PullMsgType
- func (m *GossipMessage) IsAliveMsg() bool
- func (m *GossipMessage) IsChannelRestricted() bool
- func (m *GossipMessage) IsDataMsg() bool
- func (m *GossipMessage) IsDataReq() bool
- func (m *GossipMessage) IsDataUpdate() bool
- func (m *GossipMessage) IsDigestMsg() bool
- func (m *GossipMessage) IsHelloMsg() bool
- func (m *GossipMessage) IsIdentityMsg() bool
- func (m *GossipMessage) IsLeadershipMsg() bool
- func (m *GossipMessage) IsOrgRestricted() bool
- func (m *GossipMessage) IsPullMsg() bool
- func (m *GossipMessage) IsRemoteStateMessage() bool
- func (m *GossipMessage) IsStateInfoMsg() bool
- func (m *GossipMessage) IsStateInfoPullRequestMsg() bool
- func (m *GossipMessage) IsStateInfoSnapshot() bool
- func (m *GossipMessage) IsTagLegal() error
- func NewGossipMessageComparator(dataBlockStorageSize int) common.MessageReplacingPolicy
- func (m *GossipMessage) NoopSign() (*SignedGossipMessage, error)
- func (e *Envelope) SignSecret(signer Signer, secret *Secret) error
- func (e *Envelope) ToGossipMessage() (*SignedGossipMessage, error)
- type AuthInfo
- type ConnectionInfo
- type IdentifierExtractor
- type MsgConsumer
- type ReceivedMessage
- type SignedGossipMessage
- type Signer
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func (*GossipMessage) GetPullMsgType ¶
func (m *GossipMessage) GetPullMsgType() PullMsgType
GetPullMsgType returns the phase of the pull mechanism this GossipMessage belongs to for example: Hello, Digest, etc. If this isn't a pull message, PullMsgType_UNDEFINED is returned.
func (*GossipMessage) IsAliveMsg ¶
func (m *GossipMessage) IsAliveMsg() bool
IsAliveMsg returns whether this GossipMessage is an AliveMessage
func (*GossipMessage) IsChannelRestricted ¶
func (m *GossipMessage) IsChannelRestricted() bool
IsChannelRestricted returns whether this GossipMessage should be routed only in its channel
func (*GossipMessage) IsDataMsg ¶
func (m *GossipMessage) IsDataMsg() bool
IsDataMsg returns whether this GossipMessage is a data message
func (*GossipMessage) IsDataReq ¶
func (m *GossipMessage) IsDataReq() bool
IsDataReq returns whether this GossipMessage is a data request message
func (*GossipMessage) IsDataUpdate ¶
func (m *GossipMessage) IsDataUpdate() bool
IsDataUpdate returns whether this GossipMessage is a data update message
func (*GossipMessage) IsDigestMsg ¶
func (m *GossipMessage) IsDigestMsg() bool
IsDigestMsg returns whether this GossipMessage is a digest message
func (*GossipMessage) IsHelloMsg ¶
func (m *GossipMessage) IsHelloMsg() bool
IsHelloMsg returns whether this GossipMessage is a hello message
func (*GossipMessage) IsIdentityMsg ¶
func (m *GossipMessage) IsIdentityMsg() bool
IsIdentityMsg returns whether this GossipMessage is an identity message
func (*GossipMessage) IsLeadershipMsg ¶
func (m *GossipMessage) IsLeadershipMsg() bool
IsLeadershipMsg returns whether this GossipMessage is a leadership (leader election) message
func (*GossipMessage) IsOrgRestricted ¶
func (m *GossipMessage) IsOrgRestricted() bool
IsOrgRestricted returns whether this GossipMessage should be routed only inside the organization
func (*GossipMessage) IsPullMsg ¶
func (m *GossipMessage) IsPullMsg() bool
IsPullMsg returns whether this GossipMessage is a message that belongs to the pull mechanism
func (*GossipMessage) IsRemoteStateMessage ¶
func (m *GossipMessage) IsRemoteStateMessage() bool
IsRemoteStateMessage returns whether this GossipMessage is related to state synchronization
func (*GossipMessage) IsStateInfoMsg ¶
func (m *GossipMessage) IsStateInfoMsg() bool
IsStateInfoMsg returns whether this GossipMessage is a stateInfo message
func (*GossipMessage) IsStateInfoPullRequestMsg ¶
func (m *GossipMessage) IsStateInfoPullRequestMsg() bool
IsStateInfoPullRequestMsg returns whether this GossipMessage is a stateInfoPullRequest
func (*GossipMessage) IsStateInfoSnapshot ¶
func (m *GossipMessage) IsStateInfoSnapshot() bool
IsStateInfoSnapshot returns whether this GossipMessage is a stateInfo snapshot
func (*GossipMessage) IsTagLegal ¶
func (m *GossipMessage) IsTagLegal() error
IsTagLegal checks the GossipMessage tags and inner type and returns an error if the tag doesn't match the type.
func NewGossipMessageComparator ¶
func NewGossipMessageComparator(dataBlockStorageSize int) common.MessageReplacingPolicy
NewGossipMessageComparator creates a MessageReplacingPolicy given a maximum number of blocks to hold
func (*GossipMessage) NoopSign ¶
func (m *GossipMessage) NoopSign() (*SignedGossipMessage, error)
NoopSign creates a SignedGossipMessage with a nil signature
func (*Envelope) SignSecret ¶
SignSecret signs the secret payload and creates a secret envelope out of it.
func (*Envelope) ToGossipMessage ¶
func (e *Envelope) ToGossipMessage() (*SignedGossipMessage, error)
ToGossipMessage un-marshals a given envelope and creates a SignedGossipMessage out of it. Returns an error if un-marshaling fails.
Types ¶
type AuthInfo ¶
AuthInfo represents the authentication data that was provided by the remote peer at the connection time
type ConnectionInfo ¶
type ConnectionInfo struct { ID common.PKIidType Auth *AuthInfo Identity api.PeerIdentityType Endpoint string }
ConnectionInfo represents information about the remote peer that sent a certain ReceivedMessage
func (*ConnectionInfo) IsAuthenticated ¶
func (c *ConnectionInfo) IsAuthenticated() bool
IsAuthenticated returns whether the connection to the remote peer was authenticated when the handshake took place
func (*ConnectionInfo) String ¶
func (c *ConnectionInfo) String() string
String returns a string representation of this ConnectionInfo
type IdentifierExtractor ¶
type IdentifierExtractor func(*SignedGossipMessage) string
IdentifierExtractor extracts from a SignedGossipMessage an identifier
type MsgConsumer ¶
type MsgConsumer func(message *SignedGossipMessage)
MsgConsumer invokes code given a SignedGossipMessage
type ReceivedMessage ¶
type ReceivedMessage interface { // Respond sends a GossipMessage to the origin from which this ReceivedMessage was sent from Respond(msg *GossipMessage) // GetGossipMessage returns the underlying GossipMessage GetGossipMessage() *SignedGossipMessage // GetSourceMessage Returns the Envelope the ReceivedMessage was // constructed with GetSourceEnvelope() *Envelope // GetConnectionInfo returns information about the remote peer // that sent the message GetConnectionInfo() *ConnectionInfo }
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, to obtain the raw bytes the GossipMessage was un-marshaled from, and the signature over these raw bytes.
type SignedGossipMessage ¶
type SignedGossipMessage struct { *Envelope *GossipMessage }
SignedGossipMessage contains a GossipMessage and the Envelope from which it came from
func (*SignedGossipMessage) IsSigned ¶
func (m *SignedGossipMessage) IsSigned() bool
IsSigned returns whether the message has a signature in the envelope.
func (*SignedGossipMessage) Sign ¶
func (m *SignedGossipMessage) Sign(signer Signer) (*Envelope, error)
Sign signs a GossipMessage with given Signer. Returns an Envelope on success, panics on failure.
func (*SignedGossipMessage) String ¶
func (m *SignedGossipMessage) String() string
String returns a string representation of a SignedGossipMessage