types

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2020 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LastInvHash common.Uint256

Functions

func WriteMessage

func WriteMessage(sink *comm.ZeroCopySink, msg Message)

Types

type Addr

type Addr struct {
	NodeAddrs []comm.PeerAddr
}

func (*Addr) CmdType

func (this *Addr) CmdType() string

func (*Addr) Deserialization

func (this *Addr) Deserialization(source *common.ZeroCopySource) error

func (Addr) Serialization

func (this Addr) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type AddrReq

type AddrReq struct{}

func (*AddrReq) CmdType

func (this *AddrReq) CmdType() string

func (*AddrReq) Deserialization

func (this *AddrReq) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (AddrReq) Serialization

func (this AddrReq) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type BlkHeader

type BlkHeader struct {
	BlkHdr []*ct.Header
}

func (*BlkHeader) CmdType

func (this *BlkHeader) CmdType() string

func (*BlkHeader) Deserialization

func (this *BlkHeader) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (BlkHeader) Serialization

func (this BlkHeader) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type Block

type Block struct {
	Blk        *types.Block
	MerkleRoot common.Uint256
	CCMsg      *types.CrossChainMsg
}

func (*Block) CmdType

func (this *Block) CmdType() string

func (*Block) Deserialization

func (this *Block) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (*Block) Serialization

func (this *Block) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type BlocksReq

type BlocksReq struct {
	HeaderHashCount uint8
	HashStart       comm.Uint256
	HashStop        comm.Uint256
}

func (*BlocksReq) CmdType

func (this *BlocksReq) CmdType() string

func (*BlocksReq) Deserialization

func (this *BlocksReq) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (*BlocksReq) Serialization

func (this *BlocksReq) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type Consensus

type Consensus struct {
	Cons ConsensusPayload
}

func (*Consensus) CmdType

func (this *Consensus) CmdType() string

func (*Consensus) Deserialization

func (this *Consensus) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (*Consensus) Serialization

func (this *Consensus) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type ConsensusPayload

type ConsensusPayload struct {
	Version         uint32
	PrevHash        common.Uint256
	Height          uint32
	BookkeeperIndex uint16
	Timestamp       uint32
	Data            []byte
	Owner           keypair.PublicKey
	Signature       []byte
	PeerId          common2.PeerId
	// contains filtered or unexported fields
}

func (*ConsensusPayload) Deserialization

func (this *ConsensusPayload) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (*ConsensusPayload) DeserializationUnsigned

func (this *ConsensusPayload) DeserializationUnsigned(source *common.ZeroCopySource) error

func (*ConsensusPayload) GetMessage

func (this *ConsensusPayload) GetMessage() []byte

func (*ConsensusPayload) Hash

func (this *ConsensusPayload) Hash() common.Uint256

get the consensus payload hash

func (*ConsensusPayload) Serialization

func (this *ConsensusPayload) Serialization(sink *common.ZeroCopySink)

func (*ConsensusPayload) SerializationUnsigned

func (this *ConsensusPayload) SerializationUnsigned(sink *common.ZeroCopySink)

func (*ConsensusPayload) ToArray

func (this *ConsensusPayload) ToArray() []byte

serialize the consensus payload

func (*ConsensusPayload) Verify

func (this *ConsensusPayload) Verify() error

Check whether header is correct

type DataReq

type DataReq struct {
	DataType common.InventoryType
	Hash     common.Uint256
}

func (*DataReq) CmdType

func (this *DataReq) CmdType() string

func (*DataReq) Deserialization

func (this *DataReq) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (DataReq) Serialization

func (this DataReq) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type FindNodeReq

type FindNodeReq struct {
	TargetID ncomm.PeerId
}

func (*FindNodeReq) CmdType

func (req *FindNodeReq) CmdType() string

CmdType return this message type

func (*FindNodeReq) Deserialization

func (req *FindNodeReq) Deserialization(source *common.ZeroCopySource) error

Deserialization message payload

func (FindNodeReq) Serialization

func (req FindNodeReq) Serialization(sink *common.ZeroCopySink)

Serialization message payload

type FindNodeResp

type FindNodeResp struct {
	TargetID    ncomm.PeerId
	Success     bool
	Address     string
	CloserPeers []ncomm.PeerIDAddressPair
}

func (*FindNodeResp) CmdType

func (resp *FindNodeResp) CmdType() string

CmdType return this message type

func (*FindNodeResp) Deserialization

func (resp *FindNodeResp) Deserialization(source *common.ZeroCopySource) error

Deserialization message payload

func (FindNodeResp) Serialization

func (resp FindNodeResp) Serialization(sink *common.ZeroCopySink)

Serialization message payload

type HeadersReq

type HeadersReq struct {
	Len       uint8
	HashStart common.Uint256
	HashEnd   common.Uint256
}

func (*HeadersReq) CmdType

func (this *HeadersReq) CmdType() string

func (*HeadersReq) Deserialization

func (this *HeadersReq) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (*HeadersReq) Serialization

func (this *HeadersReq) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type Inv

type Inv struct {
	P InvPayload
}

func (*Inv) CmdType

func (this *Inv) CmdType() string

func (*Inv) Deserialization

func (this *Inv) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (Inv) Serialization

func (this Inv) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type InvPayload

type InvPayload struct {
	InvType common.InventoryType
	Blk     []common.Uint256
}

type MemberInfo

type MemberInfo struct {
	PubKey string // hex encoded
	Addr   string
}

type Message

type Message interface {
	Serialization(sink *comm.ZeroCopySink)
	Deserialization(source *comm.ZeroCopySource) error
	CmdType() string
}

func ReadMessage

func ReadMessage(reader io.Reader) (Message, uint32, error)

type MsgPayload

type MsgPayload struct {
	Id          common.PeerId //peer ID
	Addr        string        //link address
	PayloadSize uint32        //payload size
	Payload     Message       //msg payload
}

MsgPayload in link channel

type NotFound

type NotFound struct {
	Hash common.Uint256
}

func (NotFound) CmdType

func (this NotFound) CmdType() string

func (*NotFound) Deserialization

func (this *NotFound) Deserialization(source *common.ZeroCopySource) error

Deserialize message payload

func (NotFound) Serialization

func (this NotFound) Serialization(sink *common.ZeroCopySink)

Serialize message payload

type Ping

type Ping struct {
	Height uint64
}

func (*Ping) CmdType

func (this *Ping) CmdType() string

func (*Ping) Deserialization

func (this *Ping) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (Ping) Serialization

func (this Ping) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type Pong

type Pong struct {
	Height uint64
}

func (Pong) CmdType

func (this Pong) CmdType() string

func (*Pong) Deserialization

func (this *Pong) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (Pong) Serialization

func (this Pong) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type RawBlockHeader

type RawBlockHeader struct {
	BlkHdr []*ct.RawHeader
}

func (*RawBlockHeader) CmdType

func (this *RawBlockHeader) CmdType() string

func (*RawBlockHeader) Deserialization

func (this *RawBlockHeader) Deserialization(source *common.ZeroCopySource) error

func (*RawBlockHeader) Serialization

func (this *RawBlockHeader) Serialization(sink *common.ZeroCopySink)

type SubnetMembers

type SubnetMembers struct {
	Members []MemberInfo
}

func (*SubnetMembers) CmdType

func (self *SubnetMembers) CmdType() string

func (*SubnetMembers) Deserialization

func (self *SubnetMembers) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (*SubnetMembers) Serialization

func (self *SubnetMembers) Serialization(sink *comm.ZeroCopySink)

func (*SubnetMembers) String

func (self *SubnetMembers) String() string

type SubnetMembersRequest

type SubnetMembersRequest struct {
	From      common.PeerId
	To        common.PeerId
	Timestamp uint32
	PubKey    keypair.PublicKey // only valid if Timestamp != 0
	Sig       []byte
}

func NewMembersRequest

func NewMembersRequest(from, to common.PeerId, acc *account.Account) (*SubnetMembersRequest, error)

func NewMembersRequestFromSeed

func NewMembersRequestFromSeed() *SubnetMembersRequest

func (*SubnetMembersRequest) CmdType

func (self *SubnetMembersRequest) CmdType() string

func (*SubnetMembersRequest) Deserialization

func (self *SubnetMembersRequest) Deserialization(source *comm.ZeroCopySource) (err error)

Deserialize message payload

func (*SubnetMembersRequest) FromSeed

func (self *SubnetMembersRequest) FromSeed() bool

func (*SubnetMembersRequest) Serialization

func (self *SubnetMembersRequest) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type Trn

type Trn struct {
	Txn *types.Transaction
}

Transaction message

func (*Trn) CmdType

func (this *Trn) CmdType() string

func (*Trn) Deserialization

func (this *Trn) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (Trn) Serialization

func (this Trn) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type UnknownMessage

type UnknownMessage struct {
	Cmd     string
	Payload []byte
}

func (*UnknownMessage) CmdType

func (self *UnknownMessage) CmdType() string

func (*UnknownMessage) Deserialization

func (self *UnknownMessage) Deserialization(source *comm.ZeroCopySource) error

func (*UnknownMessage) Serialization

func (self *UnknownMessage) Serialization(sink *comm.ZeroCopySink)

type UpdatePeerKeyId

type UpdatePeerKeyId struct {
	//TODO remove this legecy field when upgrade network layer protocal
	KadKeyId *common.PeerKeyId
}

func (*UpdatePeerKeyId) CmdType

func (this *UpdatePeerKeyId) CmdType() string

func (*UpdatePeerKeyId) Deserialization

func (this *UpdatePeerKeyId) Deserialization(source *common2.ZeroCopySource) error

func (*UpdatePeerKeyId) Serialization

func (this *UpdatePeerKeyId) Serialization(sink *common2.ZeroCopySink)

Serialize message payload

type VerACK

type VerACK struct {
	// contains filtered or unexported fields
}

func (*VerACK) CmdType

func (this *VerACK) CmdType() string

func (*VerACK) Deserialization

func (this *VerACK) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (*VerACK) Serialization

func (this *VerACK) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type Version

type Version struct {
	P VersionPayload
}

func (*Version) CmdType

func (this *Version) CmdType() string

func (*Version) Deserialization

func (this *Version) Deserialization(source *comm.ZeroCopySource) error

Deserialize message payload

func (*Version) Serialization

func (this *Version) Serialization(sink *comm.ZeroCopySink)

Serialize message payload

type VersionPayload

type VersionPayload struct {
	Version      uint32
	Services     uint64
	TimeStamp    int64
	SyncPort     uint16
	HttpInfoPort uint16
	//TODO remove this legecy field
	ConsPort    uint16
	Cap         [32]byte
	Nonce       uint64
	StartHeight uint64
	Relay       uint8
	IsConsensus bool
	SoftVersion string
}

Jump to

Keyboard shortcuts

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