Documentation ¶
Index ¶
Constants ¶
View Source
const ( MSG_VERSION = "version" MSG_DATA = "data" )
Different message types
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { Type string `json:"type"` Payload interface{} `json:"payload"` }
A message should be wrapped inside a container
func CreateNewMessage ¶
Construct a message
type Msg_Data ¶
type Msg_Data struct { Recipient string `json:"recipient"` Data string `json:"data"` TTL uint64 `json:"ttl"` }
func CreateNewDataMessage ¶
Lets create a new data message
type Msg_Version ¶
type Msg_Version struct { Version string `json:"version"` Timestamp uint64 `json:"timestamp"` AddrRecv string `json:"addr_recv"` // The network address of the node who is receiving the message AddrFrom string `json:"addr_from"` // The network address of the node who is sending the message }
func NewVersionMessage ¶
func NewVersionMessage(receivingAddress, fromAddress string) Msg_Version
Lets create a new version message
Click to show internal directories.
Click to hide internal directories.