net-ipv6
v1.1.0
Published
IPv6
Downloads
249
Maintainers
Readme
IPv6
npm install --save net-ipv6Usage
CommonJS:
const IPv6 = require( 'net-ipv6' )
const IPv6Subnet = require( 'net-ipv6/subnet' )ES Module:
import IPv6 from 'net-ipv6'
import IPv6Subnet from 'net-ipv6/subnet'API
IPv6
Constants
- IPv6.BITS =
128
Width of an IPv6 address in bits - IPv6.MIN =
0x00000000000000000000000000000000n
Lowest IPv6 address value - IPv6.MAX =
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFn
Highest IPv6 address value
Static Methods
- IPv6.isValid(
stringaddress ) :bigint
Check whether a given string is valid IPv6 address - IPv6.isGUA(
string|bigintaddress )
Whether a given address is a globally unique address (GUA) - IPv6.isULA(
string|bigintaddress )
Whether a given address is a unique local address (ULA) - IPv6.isLinkLocal(
string|bigintaddress )
Whether a given address is a link-local address - IPv6.isMulticast(
string|bigintaddress )
Whether a given address is a multicast address - IPv6.isIPv4Mapped(
string|bigintaddress ) :boolean
Whether a given address is an IPv6-mapped IPv4 address - IPv6.toNumber(
stringaddress ) :bigint
Convert a string representing an IPv6 address into an integer - IPv6.toString(
bigintaddress ) :string
Convert a number representing an IPv6 address into its expanded string representation - IPv6.toShortString(
bigintaddress ) :string
Convert a number representing an IPv6 address into its contracted string representation - IPv6.toMappedIPv4(
bigint|numberaddress ) :bigint
Convert a IPv4 address to its IPv6-mapped representation - IPv6.toSNMA(
string|bigintaddress )
Returns the solicited-node multicast address for a given unicast address - IPv6.expand(
stringaddress ) :string
Expands an IPv6 address string from it's contracted form,
for example::1to0000:0000:0000:0000:0000:0000:0000:0001 - IPv6.reverseName(
string|bigintaddress ) :string
Get the reverse DNS name for the given IPv6 address
IPv6Subnet
Constructor
- new IPv6Subnet(
stringaddress,numberprefixLength )
Instance Properties
- subnet.prefixLength
number
Length of the netmask prefix in bits - subnet.address
bigint
IPv6 address - subnet.mask
bigint
Netmask - subnet.low
bigint
Lowest address in the block - subnet.high
bigint
Highest address in the block - get subnet.wildcardMask
bigint
Wildcard mask - get subnet.addressCount
bigint
Number of addresses in the subnet
Instance Methods
- subnet.inRange(
bigintaddress ) :boolean
Whether a given address is within this subnet - subnet.toString(
booleanshort =false) :string
Get the string representation of the subnet
Static Methods
- fromRange(
bigintlow,biginthigh ) :IPv6Subnet - wildcardMask(
bigintprefixLength ) :bigint - netmask(
bigintprefixLength ) :bigint
