wire

package
v0.0.0-...-5ed304f Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadElement

func ReadElement(r io.Reader, order binary.ByteOrder, element interface{}) error

func ReadVarBytes

func ReadVarBytes(r io.Reader, order binary.ByteOrder) ([]byte, error)

ReadVarBytes reads the initial varInt and reads the following length of bytes.

func ReadVarInt

func ReadVarInt(r io.Reader, order binary.ByteOrder) (uint64, error)

ReadVarInt reads a variable length integer from r and returns it as a uint64.

func WriteElement

func WriteElement(w io.Writer, order binary.ByteOrder, element interface{}) error

writeElement writes the little endian representation of element to w.

func WriteElements

func WriteElements(w io.Writer, order binary.ByteOrder, elements ...interface{}) error

writeElements writes multiple items to w. It is equivalent to multiple calls to writeElement.

func WriteHexString

func WriteHexString(w io.Writer, order binary.ByteOrder, str string) error

WriteHexString decodes a hex string and writes the decoded bytes.

func WritePrefixedBytes

func WritePrefixedBytes(w io.Writer, order binary.ByteOrder, bytes []byte) error

WritePrefixedBytes serializes a variable length byte array to w as an int containing the number of bytes, followed by the bytes themselves.

func WritePrefixedHexString

func WritePrefixedHexString(w io.Writer, order binary.ByteOrder, str string) error

WriteVarHexString decodes a hex string and writes the decoded bytes as PrefixedBytes.

func WriteReversedHexString

func WriteReversedHexString(w io.Writer, order binary.ByteOrder, str string) error

WriteHexString decodes a hex string and writes the decoded bytes in reversed byte order.

func WriteSerializedNumber

func WriteSerializedNumber(w io.Writer, order binary.ByteOrder, val uint64) error

Special helper for Firo coinbase

func WriteVarByteArray

func WriteVarByteArray(w io.Writer, order binary.ByteOrder, byteArray [][]byte) error

func WriteVarBytes

func WriteVarBytes(w io.Writer, order binary.ByteOrder, bytes []byte) error

WriteVarBytes serializes a variable length byte array to w as a varInt containing the number of bytes, followed by the bytes themselves.

func WriteVarHexString

func WriteVarHexString(w io.Writer, order binary.ByteOrder, str string) error

WriteVarHexString decodes a hex string and writes the decoded bytes as VarBytes.

func WriteVarInt

func WriteVarInt(w io.Writer, order binary.ByteOrder, val uint64) error

WriteVarInt serializes val to w using a variable number of bytes depending on its value.

func WriteVarString

func WriteVarString(w io.Writer, order binary.ByteOrder, str string) error

WriteVarString serializes str to w as a variable length integer containing the length of the string followed by the bytes that represent the string itself.

Types

This section is empty.

Jump to

Keyboard shortcuts

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