Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a packet of data that can be transmitted as part of the p2p xud protocol. Packets are serialized using protobuf, optionally encrypted, and transmitted to peers. Each packet represents a discrete chunk of information that either sends data to or requests data from a peer.

Type parameters

  • T

Hierarchy

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • Create a packet from a deserialized packet message.

    Parameters

    • packet: PacketInterface

      a deserialized object containing a packet header and optional body

    Returns Packet

  • Create a packet from a packet body.

    Parameters

    • Optional body: T
    • Optional reqId: undefined | string

      the id of the requesting packet to set on the header if this packet is a response

    Returns Packet

Properties

Optional body

body: T

header

header: PacketHeader

Accessors

direction

responseType

type

Methods

checksum

  • checksum(): number
  • Calculating the packet checksum using its JSON representation hash first 4 bytes.

    Returns number

Abstract serialize

  • serialize(): Uint8Array

toJSON

  • toJSON(): string

toRaw

  • toRaw(): Buffer
  • Serialize this packet to binary Buffer.

    Returns Buffer

    Buffer representation of the packet

Generated using TypeDoc