msg

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxFilterLoadHashFuncs is the maximum number of hash functions to
	// load into the Bloom filter.
	MaxFilterLoadHashFuncs = 50

	// MaxFilterLoadFilterSize is the maximum size in bytes a filter may be.
	MaxFilterLoadFilterSize = 36000
)
View Source
const MaxAddrPerMsg = 1000
View Source
const MaxBlockLocatorsPerMsg = 500

MaxBlockLocatorsPerMsg is the maximum number of block locator hashes allowed per message.

View Source
const (
	// MaxFilterAddDataSize is the maximum byte size of a data
	// element to add to the Bloom filter.  It is equal to the
	// maximum element size of a script.
	MaxFilterAddDataSize = 520
)
View Source
const (
	// MaxInvPerMsg is the maximum number of inventory vectors that can be in a
	// single inv message.
	MaxInvPerMsg = 50000
)
View Source
const (
	// MaxTxFilterLoadDataSize is the maximum size in bytes a filter may be.
	MaxTxFilterLoadDataSize = 50000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr struct {
	AddrList []*p2p.NetAddress
}

func NewAddr

func NewAddr(addresses []*p2p.NetAddress) *Addr

func (*Addr) CMD

func (msg *Addr) CMD() string

func (*Addr) Deserialize

func (msg *Addr) Deserialize(r io.Reader) error

func (*Addr) MaxLength

func (msg *Addr) MaxLength() uint32

func (*Addr) Serialize

func (msg *Addr) Serialize(w io.Writer) error

type Block

type Block struct {
	common.Serializable
}

func NewBlock

func NewBlock(block common.Serializable) *Block

func (*Block) CMD

func (msg *Block) CMD() string

func (*Block) MaxLength

func (msg *Block) MaxLength() uint32

type FilterAdd

type FilterAdd struct {
	Data []byte
}

func (*FilterAdd) CMD

func (msg *FilterAdd) CMD() string

func (*FilterAdd) Deserialize

func (msg *FilterAdd) Deserialize(reader io.Reader) error

func (*FilterAdd) MaxLength

func (msg *FilterAdd) MaxLength() uint32

func (*FilterAdd) Serialize

func (msg *FilterAdd) Serialize(writer io.Writer) error

type FilterClear

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

func (*FilterClear) CMD

func (msg *FilterClear) CMD() string

func (*FilterClear) Deserialize

func (msg *FilterClear) Deserialize(io.Reader) error

func (*FilterClear) MaxLength

func (msg *FilterClear) MaxLength() uint32

func (*FilterClear) Serialize

func (msg *FilterClear) Serialize(io.Writer) error

type FilterLoad

type FilterLoad struct {
	Filter    []byte
	HashFuncs uint32
	Tweak     uint32
}

func (*FilterLoad) CMD

func (msg *FilterLoad) CMD() string

func (*FilterLoad) Deserialize

func (msg *FilterLoad) Deserialize(r io.Reader) error

func (*FilterLoad) MaxLength

func (msg *FilterLoad) MaxLength() uint32

func (*FilterLoad) Serialize

func (msg *FilterLoad) Serialize(w io.Writer) error

type GetAddr

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

func NewGetAddr

func NewGetAddr() *GetAddr

func (*GetAddr) CMD

func (msg *GetAddr) CMD() string

func (*GetAddr) Deserialize

func (msg *GetAddr) Deserialize(io.Reader) error

func (*GetAddr) MaxLength

func (msg *GetAddr) MaxLength() uint32

func (*GetAddr) Serialize

func (msg *GetAddr) Serialize(io.Writer) error

type GetBlocks

type GetBlocks struct {
	Locator  []*common.Uint256
	HashStop common.Uint256
}

func NewGetBlocks

func NewGetBlocks(locator []*common.Uint256, hashStop common.Uint256) *GetBlocks

func (*GetBlocks) CMD

func (msg *GetBlocks) CMD() string

func (*GetBlocks) Deserialize

func (msg *GetBlocks) Deserialize(reader io.Reader) error

func (*GetBlocks) MaxLength

func (msg *GetBlocks) MaxLength() uint32

func (*GetBlocks) Serialize

func (msg *GetBlocks) Serialize(w io.Writer) error

type GetData

type GetData struct {
	Inv
}

func NewGetData

func NewGetData() *GetData

func (*GetData) CMD

func (msg *GetData) CMD() string

type Inv

type Inv struct {
	InvList []*InvVect
}

func NewInv

func NewInv() *Inv

func NewInvSize

func NewInvSize(size uint) *Inv

func (*Inv) AddInvVect

func (msg *Inv) AddInvVect(iv *InvVect) error

AddInvVect adds an inventory vector to the message.

func (*Inv) CMD

func (msg *Inv) CMD() string

func (*Inv) Deserialize

func (msg *Inv) Deserialize(r io.Reader) error

func (*Inv) MaxLength

func (msg *Inv) MaxLength() uint32

func (*Inv) Serialize

func (msg *Inv) Serialize(w io.Writer) error

type InvType

type InvType uint32
const (
	InvTypeError InvType = iota
	InvTypeTx
	InvTypeBlock
	InvTypeFilteredBlock
	InvTypeConfirmedBlock
)

func (InvType) String

func (i InvType) String() string

type InvVect

type InvVect struct {
	Type InvType
	Hash common.Uint256
}

func NewInvVect

func NewInvVect(typ InvType, hash *common.Uint256) *InvVect

NewInvVect returns a new InvVect using the provided type and hash.

func (*InvVect) Deserialize

func (vect *InvVect) Deserialize(r io.Reader) error

func (*InvVect) Serialize

func (vect *InvVect) Serialize(w io.Writer) error

type Inventory

type Inventory struct {
	Inv
}

Inventory is the same to Inv message.

func NewInventory

func NewInventory() *Inventory

type MemPool

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

func (*MemPool) CMD

func (msg *MemPool) CMD() string

func (*MemPool) Deserialize

func (msg *MemPool) Deserialize(io.Reader) error

func (*MemPool) MaxLength

func (msg *MemPool) MaxLength() uint32

func (*MemPool) Serialize

func (msg *MemPool) Serialize(io.Writer) error

type MerkleBlock

type MerkleBlock struct {
	Header       common.Serializable
	Transactions uint32
	Hashes       []*common.Uint256
	Flags        []byte
}

func NewMerkleBlock

func NewMerkleBlock(header common.Serializable) *MerkleBlock

func (*MerkleBlock) CMD

func (msg *MerkleBlock) CMD() string

func (*MerkleBlock) Deserialize

func (msg *MerkleBlock) Deserialize(r io.Reader) error

func (*MerkleBlock) MaxLength

func (msg *MerkleBlock) MaxLength() uint32

func (*MerkleBlock) Serialize

func (msg *MerkleBlock) Serialize(w io.Writer) error

type NotFound

type NotFound struct {
	Inv
}

func NewNotFound

func NewNotFound() *NotFound

func (*NotFound) CMD

func (msg *NotFound) CMD() string

type Ping

type Ping struct {
	Nonce uint64
}

func NewPing

func NewPing(nonce uint64) *Ping

func (*Ping) CMD

func (msg *Ping) CMD() string

func (*Ping) Deserialize

func (msg *Ping) Deserialize(reader io.Reader) error

func (*Ping) MaxLength

func (msg *Ping) MaxLength() uint32

func (*Ping) Serialize

func (msg *Ping) Serialize(writer io.Writer) error

type Pong

type Pong struct {
	Ping
}

func NewPong

func NewPong(nonce uint64) *Pong

func (*Pong) CMD

func (msg *Pong) CMD() string

type Reject

type Reject struct {
	// Cmd is the command for the message which was rejected such as
	// as CmdBlock or CmdReject.  This can be obtained from the Command function
	// of a Message.
	Cmd string

	// RejectCode is a code indicating why the command was rejected.  It
	// is encoded as a uint8 on the wire.
	Code RejectCode

	// Reason is a human-readable string with specific details (over and
	// above the reject code) about why the command was rejected.
	Reason string

	// Hash identifies a specific block or transaction that was rejected
	// and therefore only applies the MsgBlock and MsgReject messages.
	Hash common.Uint256
}

func NewReject

func NewReject(cmd string, code RejectCode, reason string) *Reject

func (*Reject) CMD

func (msg *Reject) CMD() string

func (*Reject) Deserialize

func (msg *Reject) Deserialize(r io.Reader) (err error)

func (*Reject) MaxLength

func (msg *Reject) MaxLength() uint32

func (*Reject) Serialize

func (msg *Reject) Serialize(w io.Writer) error

type RejectCode

type RejectCode uint8

RejectCode represents a numeric value by which a remote peer indicates why a message was rejected.

const (
	RejectMalformed       RejectCode = 0x01
	RejectInvalid         RejectCode = 0x10
	RejectObsolete        RejectCode = 0x11
	RejectDuplicate       RejectCode = 0x12
	RejectNonstandard     RejectCode = 0x40
	RejectDust            RejectCode = 0x41
	RejectInsufficientFee RejectCode = 0x42
	RejectCheckpoint      RejectCode = 0x43
)

These constants define the various supported reject codes.

func (RejectCode) String

func (code RejectCode) String() string

String returns the RejectCode in human-readable form.

type Tx

type Tx struct {
	common.Serializable
}

func NewTx

func NewTx(tx common.Serializable) *Tx

func (*Tx) CMD

func (msg *Tx) CMD() string

func (*Tx) MaxLength

func (msg *Tx) MaxLength() uint32

type TxFilterLoad

type TxFilterLoad struct {
	Type uint8
	Data []byte
}

TxFilterLoad is a message to load a transaction filter, it can be a bloom filter or other transaction filters.

func (*TxFilterLoad) CMD

func (msg *TxFilterLoad) CMD() string

func (*TxFilterLoad) Deserialize

func (msg *TxFilterLoad) Deserialize(r io.Reader) error

func (*TxFilterLoad) MaxLength

func (msg *TxFilterLoad) MaxLength() uint32

func (*TxFilterLoad) Serialize

func (msg *TxFilterLoad) Serialize(w io.Writer) error

type VerAck

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

func NewVerAck

func NewVerAck() *VerAck

func (*VerAck) CMD

func (msg *VerAck) CMD() string

func (*VerAck) Deserialize

func (msg *VerAck) Deserialize(io.Reader) error

func (*VerAck) MaxLength

func (msg *VerAck) MaxLength() uint32

func (*VerAck) Serialize

func (msg *VerAck) Serialize(io.Writer) error

type Version

type Version struct {
	Version   uint32
	Services  uint64
	TimeStamp uint32
	Port      uint16
	Nonce     uint64
	Height    uint64
	Relay     bool
}

func NewVersion

func NewVersion(pver uint32, port uint16, services, nonce, height uint64,
	disableRelayTx bool) *Version

func (*Version) CMD

func (msg *Version) CMD() string

func (*Version) Deserialize

func (msg *Version) Deserialize(r io.Reader) error

func (*Version) MaxLength

func (msg *Version) MaxLength() uint32

func (*Version) Serialize

func (msg *Version) Serialize(w io.Writer) error

Jump to

Keyboard shortcuts

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