protoext

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AliveMessageToString

func AliveMessageToString(am *gossip.AliveMessage) string

AliveMessageToString of AliveMessage prints Alive Message, Identity and Timestamp

func DataDigestToString

func DataDigestToString(dig *gossip.DataDigest) string

DataDigestToString prints nonce, msg_type and digests

func DataRequestToString

func DataRequestToString(dataReq *gossip.DataRequest) string

DataRequestToString prints nonce, msg_type and digests

func DataUpdateToString

func DataUpdateToString(du *gossip.DataUpdate) string

DataUpdateToString prints Type, items and nonce

func GetPullMsgType

func GetPullMsgType(m *gossip.GossipMessage) gossip.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 InternalEndpoint

func InternalEndpoint(s *gossip.SecretEnvelope) string

InternalEndpoint returns the internal endpoint in the secret envelope, or an empty string if a failure occurs.

func IsAck

func IsAck(m *gossip.GossipMessage) bool

IsAck returns whether this GossipMessage is an acknowledgement

func IsAliveMsg

func IsAliveMsg(m *gossip.GossipMessage) bool

IsAliveMsg returns whether this GossipMessage is an AliveMessage

func IsChannelRestricted

func IsChannelRestricted(m *gossip.GossipMessage) bool

IsChannelRestricted returns whether this GossipMessage should be routed only in its channel

func IsDataMsg

func IsDataMsg(m *gossip.GossipMessage) bool

IsDataMsg returns whether this GossipMessage is a data message

func IsDataReq

func IsDataReq(m *gossip.GossipMessage) bool

IsDataReq returns whether this GossipMessage is a data request message

func IsDataUpdate

func IsDataUpdate(m *gossip.GossipMessage) bool

IsDataUpdate returns whether this GossipMessage is a data update message

func IsDigestMsg

func IsDigestMsg(m *gossip.GossipMessage) bool

IsDigestMsg returns whether this GossipMessage is a digest message

func IsHelloMsg

func IsHelloMsg(m *gossip.GossipMessage) bool

IsHelloMsg returns whether this GossipMessage is a hello message

func IsIdentityMsg

func IsIdentityMsg(m *gossip.GossipMessage) bool

IsIdentityMsg returns whether this GossipMessage is an identity message

func IsLeadershipMsg

func IsLeadershipMsg(m *gossip.GossipMessage) bool

IsLeadershipMsg returns whether this GossipMessage is a leadership (leader election) message

func IsOrgRestricted

func IsOrgRestricted(m *gossip.GossipMessage) bool

IsOrgRestricted returns whether this GossipMessage should be routed only inside the organization

func IsPrivateDataMsg

func IsPrivateDataMsg(m *gossip.GossipMessage) bool

IsPrivateDataMsg returns whether this message is related to private data

func IsPullMsg

func IsPullMsg(m *gossip.GossipMessage) bool

IsPullMsg returns whether this GossipMessage is a message that belongs to the pull mechanism

func IsRemoteStateMessage

func IsRemoteStateMessage(m *gossip.GossipMessage) bool

IsRemoteStateMessage returns whether this GossipMessage is related to state synchronization

func IsStateInfoMsg

func IsStateInfoMsg(m *gossip.GossipMessage) bool

IsStateInfoMsg returns whether this GossipMessage is a stateInfo message

func IsStateInfoPullRequestMsg

func IsStateInfoPullRequestMsg(m *gossip.GossipMessage) bool

IsStateInfoPullRequestMsg returns whether this GossipMessage is a stateInfoPullRequest

func IsStateInfoSnapshot

func IsStateInfoSnapshot(m *gossip.GossipMessage) bool

IsStateInfoSnapshot returns whether this GossipMessage is a stateInfo snapshot

func IsTagLegal

func IsTagLegal(m *gossip.GossipMessage) error

IsTagLegal checks the GossipMessage tags and inner type and returns an error if the tag doesn't match the type.

func LeadershipMessageToString

func LeadershipMessageToString(lm *gossip.LeadershipMessage) string

LeadershipMessageToString prints PKI-id, Timestamp and Is Declaration

func MemberToString

func MemberToString(m *gossip.Member) string

MemberToString prints Endpoint and PKI-id

func MembershipRequestToString

func MembershipRequestToString(mr *gossip.MembershipRequest) string

MembershipRequestToString prints self information

func MembershipResponseToString

func MembershipResponseToString(mr *gossip.MembershipResponse) string

MembershipResponseToString of MembershipResponse prints number of Alive and number of Dead

func NewGossipMessageComparator

func NewGossipMessageComparator(dataBlockStorageSize int) common.MessageReplacingPolicy

NewGossipMessageComparator creates a MessageReplacingPolicy given a maximum number of blocks to hold

func PayloadToString

func PayloadToString(p *gossip.Payload) string

PayloadToString prints Block message: Data and seq

func RemovePvtDataResponseToString

func RemovePvtDataResponseToString(res *gossip.RemotePvtDataResponse) string

RemovePvtDataResponseToString returns a string representation of this RemotePvtDataResponse

func SignSecret

func SignSecret(e *gossip.Envelope, signer Signer, secret *gossip.Secret) error

SignSecret signs the secret payload and creates a secret envelope out of it.

func StateInfoPullRequestToString

func StateInfoPullRequestToString(sipr *gossip.StateInfoPullRequest) string

StateInfoPullRequestToString prints Channel MAC

func StateInfoSnapshotToString

func StateInfoSnapshotToString(sis *gossip.StateInfoSnapshot) string

StateInfoSnapshotToString prints items

func StateInfoToString

func StateInfoToString(si *gossip.StateInfo) string

StateInfoToString prints Timestamp and PKI-id

Types

type AuthInfo

type AuthInfo struct {
	SignedData []byte
	Signature  []byte
}

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) String

func (c *ConnectionInfo) String() string

String returns a string representation of this ConnectionInfo

type ReceivedMessage

type ReceivedMessage interface {
	// Respond sends a GossipMessage to the origin from which this ReceivedMessage was sent from
	Respond(msg *gossip.GossipMessage)

	// GetGossipMessage returns the underlying GossipMessage
	GetGossipMessage() *SignedGossipMessage

	// GetSourceMessage Returns the Envelope the ReceivedMessage was
	// constructed with
	GetSourceEnvelope() *gossip.Envelope

	// GetConnectionInfo returns information about the remote peer
	// that sent the message
	GetConnectionInfo() *ConnectionInfo

	// Ack returns to the sender an acknowledgement for the message
	// An ack can receive an error that indicates that the operation related
	// to the message has failed
	Ack(err error)
}

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 {
	*gossip.Envelope
	*gossip.GossipMessage
}

SignedGossipMessage contains a GossipMessage and the Envelope from which it came from

func EnvelopeToGossipMessage

func EnvelopeToGossipMessage(e *gossip.Envelope) (*SignedGossipMessage, error)

EnvelopeToGossipMessage un-marshals a given envelope and creates a SignedGossipMessage out of it. Returns an error if un-marshaling fails.

func NoopSign

NoopSign creates a SignedGossipMessage with a nil signature

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) (*gossip.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

func (*SignedGossipMessage) Verify

func (m *SignedGossipMessage) Verify(peerIdentity []byte, verify Verifier) error

Verify verifies a signed GossipMessage with a given Verifier. Returns nil on success, error on failure.

type Signer

type Signer func(msg []byte) ([]byte, error)

Signer signs a message, and returns (signature, nil) on success, and nil and an error on failure.

type Verifier

type Verifier func(peerIdentity []byte, signature, message []byte) error

Verifier receives a peer identity, a signature and a message and returns nil if the signature on the message could be verified using the given identity.

Source Files

  • message.go
  • msgcomparator.go
  • receivedmessage.go
  • signing.go
  • stringers.go

Jump to

Keyboard shortcuts

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