discovery

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: MIT Imports: 8 Imported by: 0

README

Ping

Ping message sent by new node who wants to join in the consensus. The message is broadcasted to the shard. It contains the public BLS key of consensus and the peerID of the node. For backward compatibility, it still contains the IP/Port of the node, but it will be removed once the full integration of libp2p is finished as the IP/Port is not needed.

It also contains a Role field to indicate if the node is a client node or regular node, as client node won't join the consensus.

TODO

The following two todo should be worked on once we have full libp2p integration. For network security reason, we should in general not expose the IP/Port of the node.

-[] remove peer info in Ping message, only keep peerID, which should be sufficient for p2p communication.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PingMessageType

type PingMessageType struct {
	Version uint16 // version of the protocol
	NodeVer string // version of the node binary
	Node    node.Info
}

PingMessageType defines the data structure of the Ping message

func GetPingMessage

func GetPingMessage(payload []byte) (*PingMessageType, error)

GetPingMessage deserializes the Ping Message from a list of byte

func NewPingMessage

func NewPingMessage(peer p2p.Peer, isClient bool) *PingMessageType

NewPingMessage creates a new Ping message based on the p2p.Peer input

func (PingMessageType) ConstructPingMessage

func (p PingMessageType) ConstructPingMessage() []byte

ConstructPingMessage contructs ping message from node to leader

func (PingMessageType) String

func (p PingMessageType) String() string

Jump to

Keyboard shortcuts

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