Documentation ¶
Index ¶
- func ReadHash(reader io.Reader) (*utils.Hash, error)
- func ReadString(reader io.Reader, size uint64) (string, error)
- func ReadUint16(reader io.Reader) (uint16, error)
- func ReadUint32(reader io.Reader) (uint32, error)
- func ReadUint64(reader io.Reader) (uint64, error)
- func ReadUint8(reader io.Reader) (uint8, error)
- func ReadVarString(reader io.Reader) (string, error)
- func ReadVarUint(reader io.Reader) (uint64, error)
- func WriteAddress(writer io.Writer, address *Address) error
- func WriteHash(writer io.Writer, hash *utils.Hash) error
- func WriteMessage(writer io.Writer, msg Message) error
- func WriteString(writer io.Writer, value string) error
- func WriteUint16(writer io.Writer, value uint16) error
- func WriteUint32(writer io.Writer, value uint32) error
- func WriteUint64(writer io.Writer, value uint64) error
- func WriteUint8(writer io.Writer, value uint8) error
- func WriteVarString(writer io.Writer, value string) error
- func WriteVarUint(writer io.Writer, value uint64) error
- type AddrMessage
- type Address
- type BlockHeader
- type BlockMessage
- type GetAddrMessage
- type GetBlocksMessage
- type GetDataMessage
- type GetMempoolMessage
- type InvMessage
- type InvVect
- type InvVectType
- type Message
- type MinusOneThatsThreeMessage
- type NotFoundMessage
- type Outpoint
- type TwoPlusTwoIsFourMessage
- type TxIn
- type TxMessage
- type TxOut
- type WhoamiAckMessage
- type WhoamiMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteMessage ¶
WriteMessage encodes a message and writes it in a io.Writer. It generates the header of the message.
Types ¶
type AddrMessage ¶
type AddrMessage struct {
Addresses []*Address
}
func NewAddrMessage ¶
func NewAddrMessage() *AddrMessage
func (*AddrMessage) MsgType ¶
func (msg *AddrMessage) MsgType() string
func (AddrMessage) String ¶
func (msg AddrMessage) String() string
type BlockHeader ¶
type BlockHeader struct { Version uint32 Flags []string HashPrevBlock *utils.Hash HashMerkleRoot *utils.Hash Timestamp time.Time Height uint32 Target *big.Int Nonce uint64 }
func (*BlockHeader) Hash ¶
func (header *BlockHeader) Hash() *utils.Hash
func (*BlockHeader) HashString ¶
func (header *BlockHeader) HashString() string
type BlockMessage ¶
type BlockMessage struct { Header *BlockHeader Txs []*TxMessage }
func NewBlockMessage ¶
func NewBlockMessage() *BlockMessage
func (*BlockMessage) MsgType ¶
func (msg *BlockMessage) MsgType() string
func (BlockMessage) String ¶
func (msg BlockMessage) String() string
type GetAddrMessage ¶
type GetAddrMessage struct { }
func NewGetAddrMessage ¶
func NewGetAddrMessage() *GetAddrMessage
func (*GetAddrMessage) MsgType ¶
func (msg *GetAddrMessage) MsgType() string
func (GetAddrMessage) String ¶
func (msg GetAddrMessage) String() string
type GetBlocksMessage ¶
func NewGetBlocksMessage ¶
func NewGetBlocksMessage() *GetBlocksMessage
func (*GetBlocksMessage) MsgType ¶
func (msg *GetBlocksMessage) MsgType() string
func (GetBlocksMessage) String ¶
func (msg GetBlocksMessage) String() string
type GetDataMessage ¶
type GetDataMessage struct {
Inventory []*InvVect
}
func NewGetDataMessage ¶
func NewGetDataMessage() *GetDataMessage
func (*GetDataMessage) MsgType ¶
func (msg *GetDataMessage) MsgType() string
func (GetDataMessage) String ¶
func (msg GetDataMessage) String() string
type GetMempoolMessage ¶
type GetMempoolMessage struct { }
func NewGetMempoolMessage ¶
func NewGetMempoolMessage() *GetMempoolMessage
func (*GetMempoolMessage) MsgType ¶
func (msg *GetMempoolMessage) MsgType() string
func (GetMempoolMessage) String ¶
func (msg GetMempoolMessage) String() string
type InvMessage ¶
type InvMessage struct {
Inventory []*InvVect
}
func NewInvMessage ¶
func NewInvMessage() *InvMessage
func (*InvMessage) MsgType ¶
func (msg *InvMessage) MsgType() string
func (InvMessage) String ¶
func (msg InvMessage) String() string
type InvVect ¶
type InvVect struct { InvType InvVectType Hash *utils.Hash }
type InvVectType ¶
type InvVectType uint32
const ( INV_VECT_TX InvVectType = 0 INV_VECT_BLOCK InvVectType = 1 )
type MinusOneThatsThreeMessage ¶
type MinusOneThatsThreeMessage struct { }
func NewMinusOneThatsThreeMessage ¶
func NewMinusOneThatsThreeMessage() *MinusOneThatsThreeMessage
func (*MinusOneThatsThreeMessage) Decode ¶
func (msg *MinusOneThatsThreeMessage) Decode(reader io.Reader) error
func (*MinusOneThatsThreeMessage) Encode ¶
func (msg *MinusOneThatsThreeMessage) Encode(writer io.Writer) error
func (*MinusOneThatsThreeMessage) MsgType ¶
func (msg *MinusOneThatsThreeMessage) MsgType() string
func (MinusOneThatsThreeMessage) String ¶
func (msg MinusOneThatsThreeMessage) String() string
type NotFoundMessage ¶
type NotFoundMessage struct {
Inventory []*InvVect
}
func NewNotFoundMessage ¶
func NewNotFoundMessage() *NotFoundMessage
func (*NotFoundMessage) MsgType ¶
func (msg *NotFoundMessage) MsgType() string
func (NotFoundMessage) String ¶
func (msg NotFoundMessage) String() string
type TwoPlusTwoIsFourMessage ¶
type TwoPlusTwoIsFourMessage struct { }
TwoPlusTwoIsFourMessage represents the message 2plus2is4.
func NewTwoPlusTwoIsFourMessage ¶
func NewTwoPlusTwoIsFourMessage() *TwoPlusTwoIsFourMessage
NewTwoPlusTwoIsFourMessage returns a TwoPlusTwoIsFourMessage instance.
func (*TwoPlusTwoIsFourMessage) Decode ¶
func (msg *TwoPlusTwoIsFourMessage) Decode(reader io.Reader) error
Decode implements the Message interface.
func (*TwoPlusTwoIsFourMessage) Encode ¶
func (msg *TwoPlusTwoIsFourMessage) Encode(writer io.Writer) error
Encode implements the Message interface.
func (*TwoPlusTwoIsFourMessage) MsgType ¶
func (msg *TwoPlusTwoIsFourMessage) MsgType() string
MsgType implements the Message interface.
func (TwoPlusTwoIsFourMessage) String ¶
func (msg TwoPlusTwoIsFourMessage) String() string
type TxMessage ¶
func NewTxMessage ¶
func NewTxMessage() *TxMessage
type WhoamiAckMessage ¶
type WhoamiAckMessage struct { }
func NewWhoamiAckMessage ¶
func NewWhoamiAckMessage() *WhoamiAckMessage
func (*WhoamiAckMessage) MsgType ¶
func (msg *WhoamiAckMessage) MsgType() string
func (WhoamiAckMessage) String ¶
func (msg WhoamiAckMessage) String() string
type WhoamiMessage ¶
func NewWhoamiMessage ¶
func NewWhoamiMessage() *WhoamiMessage
func (*WhoamiMessage) MsgType ¶
func (msg *WhoamiMessage) MsgType() string
func (WhoamiMessage) String ¶
func (msg WhoamiMessage) String() string
Click to show internal directories.
Click to hide internal directories.