How to use the ip-address.Address6.fromByteArray function in ip-address

To help you get started, we’ve selected a few ip-address examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neo-one-suite / neo-one / packages / neo-one-node-protocol / src / payload / NetworkAddress.ts View on Github external
public static deserializeWireBase({ reader }: DeserializeWireBaseOptions): NetworkAddress {
    const timestamp = reader.readUInt32LE();
    const services = reader.readUInt64LE();
    const address = Address6.fromByteArray([...reader.readBytes(16)]) as Address6 | undefined | null;
    const port = reader.readUInt16BE();

    const canonical = address == undefined ? '' : (address.canonicalForm() as string | undefined | null);

    return new this({
      timestamp,
      services,
      host: canonical == undefined ? '' : canonical,
      port,
    });
  }

ip-address

A library for parsing IPv4 and IPv6 IP addresses in node and the browser.

MIT
Latest version published 1 month ago

Package Health Score

85 / 100
Full package analysis