Class: IPTools

IPTools()

IP Address Conversion and CIDR calculator

Constructor

new IPTools()

Source:

Methods

CalcCIDR(ip_addr) → {Promise}

Given an IP address or IP address with CIDR notation, provides information about an IP address range
Parameters:
Name Type Description
ip_addr string An IP address with or without CIDR notation
Source:
Returns:
a list of objects containing information about the IP address range Promise will resolve to type array.
Type
Promise

CompressIPv6(ip6_addr) → {Promise}

Compress the zeros in an IPv6 address
Parameters:
Name Type Description
ip6_addr string An IPv6 address
Source:
Returns:
The same IPv6 address with zeros compressed Promise will resolve to type object.
Type
Promise

ExpandIPv6(ip6_addr) → {Promise}

Expand the zeros in an IPv6 address
Parameters:
Name Type Description
ip6_addr string An IPv6 address
Source:
Returns:
The same IPv6 address with zeros expanded Promise will resolve to type object.
Type
Promise

IP4FromDecimal(ip4_number) → {Promise}

Convert from a Decimal representationan of an IP address
Parameters:
Name Type Description
ip4_number string Decimal representation of an IP address
Source:
Returns:
The IP address Promise will resolve to type string.
Type
Promise

IP6FromDecimal(ip6_number) → {Promise}

Convert from a Decimal representationan of an IP address
Parameters:
Name Type Description
ip6_number string Decimal representation of an IP address
Source:
Returns:
The IP address Promise will resolve to type string.
Type
Promise

IPToDecimal(ip_addr) → {Promise}

Convert an IP address to a Decimal representation
Parameters:
Name Type Description
ip_addr string An IP address
Source:
Returns:
Decimal representation of the provided IP address Promise will resolve to type string.
Type
Promise

IPv4ToIPv6(ip_addr) → {Promise}

Convert an IPv4 address to an IPv6 address
Parameters:
Name Type Description
ip_addr string An IPv4 address
Source:
Returns:
An object containing IPv6 representations of the provided IPv4 address Promise will resolve to type object.
Type
Promise

SubnetMaskToCIDR(subnet_mask) → {Promise}

Convert a subnet mask to CIDR notation
Parameters:
Name Type Description
subnet_mask string A subnet mask eg. 255.255.0.0
Source:
Returns:
object containing information about subnet including CIDR prefix Promise will resolve to type object.
Type
Promise