Documentation ¶
Overview ¶
Package message is a generated protocol buffer package.
It is generated from these files:
message.proto
It has these top-level messages:
Message State PeerRequest PeerResponse Peer Header Block Transaction
Index ¶
- Variables
- type Block
- type Flag
- type Header
- type Message
- func (*Message) Descriptor() ([]byte, []int)
- func (m *Message) GetBlock() *Block
- func (m *Message) GetFlag() Flag
- func (m *Message) GetPayload() isMessage_Payload
- func (m *Message) GetPeerRequest() *PeerRequest
- func (m *Message) GetPeerResponse() *PeerResponse
- func (m *Message) GetState() *State
- func (m *Message) GetTransaction() *Transaction
- func (*Message) ProtoMessage()
- func (m *Message) Reset()
- func (m *Message) String() string
- func (*Message) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type Message_Block
- type Message_PeerRequest
- type Message_PeerResponse
- type Message_State
- type Message_Transaction
- type Peer
- type PeerRequest
- type PeerResponse
- type State
- type Transaction
Constants ¶
This section is empty.
Variables ¶
View Source
var Flag_name = map[int32]string{
0: "consensus",
1: "payload",
}
View Source
var Flag_value = map[string]int32{
"consensus": 0,
"payload": 1,
}
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { // Head of the block that also will be used for computing its hash. Header *Header `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` // List of recorded transactions. Transactions []*Transaction `protobuf:"bytes,2,rep,name=transactions" json:"transactions,omitempty"` }
Block represents a very simple Block used for simulation.
func (*Block) Descriptor ¶
func (*Block) GetTransactions ¶
func (m *Block) GetTransactions() []*Transaction
func (*Block) ProtoMessage ¶
func (*Block) ProtoMessage()
type Header ¶
type Header struct { // Index of the block. Index uint32 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"` // Nonce used to prevent hash collisions. Nonce uint64 `protobuf:"varint,2,opt,name=nonce" json:"nonce,omitempty"` }
Header represents a very simple block header used for simulation.
func (*Header) Descriptor ¶
func (*Header) ProtoMessage ¶
func (*Header) ProtoMessage()
type Message ¶
type Message struct { Flag Flag `protobuf:"varint,1,opt,name=flag,enum=message.Flag" json:"flag,omitempty"` // Types that are valid to be assigned to Payload: // *Message_State // *Message_PeerRequest // *Message_PeerResponse // *Message_Transaction // *Message_Block Payload isMessage_Payload `protobuf_oneof:"Payload"` }
func (*Message) Descriptor ¶
func (*Message) GetPayload ¶
func (m *Message) GetPayload() isMessage_Payload
func (*Message) GetPeerRequest ¶
func (m *Message) GetPeerRequest() *PeerRequest
func (*Message) GetPeerResponse ¶
func (m *Message) GetPeerResponse() *PeerResponse
func (*Message) GetTransaction ¶
func (m *Message) GetTransaction() *Transaction
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
type Message_Block ¶
type Message_Block struct {
Block *Block `protobuf:"bytes,6,opt,name=block,oneof"`
}
type Message_PeerRequest ¶
type Message_PeerRequest struct {
PeerRequest *PeerRequest `protobuf:"bytes,3,opt,name=peer_request,json=peerRequest,oneof"`
}
type Message_PeerResponse ¶
type Message_PeerResponse struct {
PeerResponse *PeerResponse `protobuf:"bytes,4,opt,name=peer_response,json=peerResponse,oneof"`
}
type Message_State ¶
type Message_State struct {
State *State `protobuf:"bytes,2,opt,name=state,oneof"`
}
type Message_Transaction ¶
type Message_Transaction struct {
Transaction *Transaction `protobuf:"bytes,5,opt,name=transaction,oneof"`
}
type Peer ¶
type Peer struct {
Enpoint string `protobuf:"bytes,1,opt,name=enpoint" json:"enpoint,omitempty"`
}
Peer holds information about a peer in the network.
func (*Peer) Descriptor ¶
func (*Peer) GetEnpoint ¶
func (*Peer) ProtoMessage ¶
func (*Peer) ProtoMessage()
type PeerRequest ¶
type PeerRequest struct { // A list of already known peers in the network. Known []string `protobuf:"bytes,1,rep,name=known" json:"known,omitempty"` }
PeerRequest requests known peers in the network.
func (*PeerRequest) Descriptor ¶
func (*PeerRequest) Descriptor() ([]byte, []int)
func (*PeerRequest) GetKnown ¶
func (m *PeerRequest) GetKnown() []string
func (*PeerRequest) ProtoMessage ¶
func (*PeerRequest) ProtoMessage()
func (*PeerRequest) Reset ¶
func (m *PeerRequest) Reset()
func (*PeerRequest) String ¶
func (m *PeerRequest) String() string
type PeerResponse ¶
type PeerResponse struct {
Peers []*Peer `protobuf:"bytes,1,rep,name=peers" json:"peers,omitempty"`
}
PeerResponse contains a list of known peers responded after a PeerRequest is send.
func (*PeerResponse) Descriptor ¶
func (*PeerResponse) Descriptor() ([]byte, []int)
func (*PeerResponse) GetPeers ¶
func (m *PeerResponse) GetPeers() []*Peer
func (*PeerResponse) ProtoMessage ¶
func (*PeerResponse) ProtoMessage()
func (*PeerResponse) Reset ¶
func (m *PeerResponse) Reset()
func (*PeerResponse) String ¶
func (m *PeerResponse) String() string
type State ¶
type State struct { // unique peer identifier. Id uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` // port the peer is accepting connections on. Port uint32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"` }
State is used in the initial handshake.
func (*State) Descriptor ¶
func (*State) ProtoMessage ¶
func (*State) ProtoMessage()
type Transaction ¶
type Transaction struct { // Nonce used to prevent hash collisions. Nonce uint64 `protobuf:"varint,1,opt,name=nonce" json:"nonce,omitempty"` }
Transaction represents a very simple transaction used for simulation.
func NewTransaction ¶
func NewTransaction() *Transaction
NewTransaction will create a new random Transaction.
func (*Transaction) Descriptor ¶
func (*Transaction) Descriptor() ([]byte, []int)
func (*Transaction) GetNonce ¶
func (m *Transaction) GetNonce() uint64
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() []byte
Hash computes the double sha256 hash.
func (*Transaction) ProtoMessage ¶
func (*Transaction) ProtoMessage()
func (*Transaction) Reset ¶
func (m *Transaction) Reset()
func (*Transaction) String ¶
func (m *Transaction) String() string
Click to show internal directories.
Click to hide internal directories.