message

package
v0.0.2-d277 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleNodeMsg

func HandleNodeMsg(node Noder, buf []byte, len int) error

FIXME the length exceed int32 case?

func MsgType

func MsgType(buf []byte) (string, error)

func NewAddrs

func NewAddrs(nodeaddrs []NodeAddr, count uint64) ([]byte, error)

func NewBlock

func NewBlock(bk *ledger.Block) ([]byte, error)

func NewBlockFromHash

func NewBlockFromHash(hash common.Uint256) (*ledger.Block, error)

func NewBlocksReq

func NewBlocksReq(blocator []Uint256, hash Uint256) ([]byte, error)

func NewInv

func NewInv(inv *InvPayload) ([]byte, error)

func NewMsg

func NewMsg(t string, n Noder) ([]byte, error)

TODO combine all of message alloc in one function via interface

func NewNotFound

func NewNotFound(hash common.Uint256) ([]byte, error)

func NewPingMsg

func NewPingMsg() ([]byte, error)

func NewPongMsg

func NewPongMsg() ([]byte, error)

func NewTxn

func NewTxn(txn *transaction.Transaction) ([]byte, error)

func NewVerack

func NewVerack() ([]byte, error)

func NewVersion

func NewVersion(n Noder) ([]byte, error)

func PayloadLen

func PayloadLen(buf []byte) int

func ReqBlkData

func ReqBlkData(node Noder, hash common.Uint256) error

func SendMsgSyncBlockHeaders

func SendMsgSyncBlockHeaders(node Noder, blocator []Uint256, hash Uint256)

func ValidMsgHdr

func ValidMsgHdr(buf []byte) bool

Types

type Inv

type Inv struct {
	P InvPayload
	// contains filtered or unexported fields
}

func (*Inv) Deserialization

func (msg *Inv) Deserialization(p []byte) error

func (Inv) Handle

func (msg Inv) Handle(node Noder) error

func (Inv) Serialization

func (msg Inv) Serialization() ([]byte, error)

func (Inv) Verify

func (hdr Inv) Verify(buf []byte) error

Verify the message header information @p payload of the message

type InvPayload

type InvPayload struct {
	Cnt uint32
	Blk []byte
}

func GetInvFromBlockHash

func GetInvFromBlockHash(startHash Uint256, stopHash Uint256) (*InvPayload, error)

func (*InvPayload) Serialization

func (msg *InvPayload) Serialization(w io.Writer)

type Messager

type Messager interface {
	Verify([]byte) error
	Serialization() ([]byte, error)
	Deserialization([]byte) error
	Handle(Noder) error
}

func AllocMsg

func AllocMsg(t string, length int) Messager

Alloc different message stucture @t the message name or type @len the message length only valid for varible length structure

Return: @messager the messager interface @error error code FixMe fix the ugly multiple return.

Jump to

Keyboard shortcuts

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