message

package
v0.0.0-...-df2b3d5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: MIT Imports: 6 Imported by: 0

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

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 NewBlock

func NewBlock(prevIndex uint32) *Block

NewBlock will create a new block.

func (*Block) Descriptor

func (*Block) Descriptor() ([]byte, []int)

func (*Block) GetHeader

func (m *Block) GetHeader() *Header

func (*Block) GetTransactions

func (m *Block) GetTransactions() []*Transaction

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) Reset

func (m *Block) Reset()

func (*Block) String

func (m *Block) String() string

type Flag

type Flag int32
const (
	Flag_consensus Flag = 0
	Flag_payload   Flag = 1
)

func (Flag) EnumDescriptor

func (Flag) EnumDescriptor() ([]byte, []int)

func (Flag) String

func (x Flag) String() string
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) Descriptor() ([]byte, []int)

func (*Header) GetIndex

func (m *Header) GetIndex() uint32

func (*Header) GetNonce

func (m *Header) GetNonce() uint64

func (*Header) ProtoMessage

func (*Header) ProtoMessage()

func (*Header) Reset

func (m *Header) Reset()

func (*Header) String

func (m *Header) String() string

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) Descriptor() ([]byte, []int)

func (*Message) GetBlock

func (m *Message) GetBlock() *Block

func (*Message) GetFlag

func (m *Message) GetFlag() Flag

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

func (m *Message) GetState() *State

func (*Message) GetTransaction

func (m *Message) GetTransaction() *Transaction

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) Reset

func (m *Message) Reset()

func (*Message) String

func (m *Message) String() string

func (*Message) XXX_OneofFuncs

func (*Message) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

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) Descriptor() ([]byte, []int)

func (*Peer) GetEnpoint

func (m *Peer) GetEnpoint() string

func (*Peer) ProtoMessage

func (*Peer) ProtoMessage()

func (*Peer) Reset

func (m *Peer) Reset()

func (*Peer) String

func (m *Peer) String() string

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) Descriptor() ([]byte, []int)

func (*State) GetId

func (m *State) GetId() uint64

func (*State) GetPort

func (m *State) GetPort() uint32

func (*State) ProtoMessage

func (*State) ProtoMessage()

func (*State) Reset

func (m *State) Reset()

func (*State) String

func (m *State) String() string

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

Jump to

Keyboard shortcuts

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