How to use the ip-address.Address6.fromAddress4 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 getAddress6(host: string): Address6 | null | undefined {
    const parts = host.split('.');

    return parts.length === 4 ? Address6.fromAddress4(host) : new Address6(host);
  }
github neo-one-suite / neo-one / packages / neo-one-node-protocol / src / Node.ts View on Github external
.map((peer) => {
          const { address, port } = peer;

          let canonicalForm = new Address6(address).canonicalForm() as string | undefined | null;

          if (canonicalForm == undefined) {
            canonicalForm = Address6.fromAddress4(address).canonicalForm() as string | undefined | null;
          }

          return { host: canonicalForm == undefined ? '' : canonicalForm, port };
        })
        .filter((endpoint) => !LOCAL_HOST_ADDRESSES.has(endpoint.host))

ip-address

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

MIT
Latest version published 7 months ago

Package Health Score

84 / 100
Full package analysis