Represents an IPv4 address
string
address
:
An IPv4 address string
.fromBigInteger(bigInteger)
Converts a BigInteger to a v4 address object
Converts a BigInteger to a v4 address object
BigInteger
bigInteger
:
a BigInteger to convert
Address4
.fromHex(hex)
Converts a hex string to an IPv4 address object
.fromInteger(integer)
Converts an integer into a IPv4 address object
Converts an integer into a IPv4 address object
integer
integer
:
a number to convert
Address4
#bigInteger
Returns the address as a BigInteger
Returns the address as a BigInteger
BigInteger
#binaryZeroPad
Returns a zero-padded base-2 string representation of the address
Returns a zero-padded base-2 string representation of the address
string
#correctForm
Returns the correct form of an address
Returns the correct form of an address
String
#endAddress
The last address in the range given by this address' subnet Often referred to as the Broadcast
The last address in the range given by this address' subnet Often referred to as the Broadcast
Address4
#getBitsBase2(start, end)
Returns the bits in the given range as a base-2 string
Returns the bits in the given range as a base-2 string
string
#isCorrect
Returns true if the address is correct, false otherwise
Returns true if the address is correct, false otherwise
Boolean
#isInSubnet
Returns true if the given address is in the subnet of the current address
Returns true if the given address is in the subnet of the current address
boolean
#isValid
Return true if the address is valid
Return true if the address is valid
Boolean
#mask(optionalMask)
Returns the first n bits of the address, defaulting to the subnet mask
Returns the first n bits of the address, defaulting to the subnet mask
String
#startAddress
The first address in the range given by this address' subnet. Often referred to as the Network Address.
The first address in the range given by this address' subnet. Often referred to as the Network Address.
Address4
#toArray
Converts an IPv4 address object to an array of bytes
Converts an IPv4 address object to an array of bytes
Array
#toGroup6
Converts an IPv4 address object to an IPv6 address group
Converts an IPv4 address object to an IPv6 address group
String
#toHex
Converts an IPv4 address object to a hex string
Converts an IPv4 address object to a hex string
String
Represents an IPv6 address
string
address
:
An IPv6 address string
[number
]
groups
(default 8
)
:
How many octets to parse
var address = new Address6('2001::/32');
.RE_BAD_ADDRESS
A regular expression that matches an incorrect IPv6 address
A regular expression that matches an incorrect IPv6 address
.RE_BAD_CHARACTERS
A regular expression that matches bad characters in an IPv6 address
A regular expression that matches bad characters in an IPv6 address
.RE_SUBNET_STRING
A regular expression that matches an IPv6 subnet
A regular expression that matches an IPv6 subnet
.RE_ZONE_STRING
A regular expression that matches an IPv6 zone
A regular expression that matches an IPv6 zone
.SCOPES
Represents IPv6 address scopes
Represents IPv6 address scopes
.TYPES
Represents IPv6 address types
Represents IPv6 address types
.fromAddress4(address, address4)
Create an IPv6-mapped address given an IPv4 address
Create an IPv6-mapped address given an IPv4 address
string
address
:
An IPv4 address string
Address6
var address = Address6.fromAddress4('192.168.0.1');
address.correctForm(); // '::ffff:c0a8:1'
address.to4in6(); // '::ffff:192.168.0.1'
.fromBigInteger(bigInteger)
Convert a BigInteger to a v6 address object
Convert a BigInteger to a v6 address object
BigInteger
bigInteger
:
a BigInteger to convert
Address6
var bigInteger = new BigInteger('1000000000000');
var address = Address6.fromBigInteger(bigInteger);
address.correctForm(); // '::e8:d4a5:1000'
.fromByteArray(bytes)
Convert a byte array to an Address6 object
Convert a byte array to an Address6 object
Address6
.fromURL(url)
Convert a URL (with optional port number) to an address object
Convert a URL (with optional port number) to an address object
string
url
:
a URL with optional port number
Address6
var addressAndPort = Address6.fromURL('http://[ffff::]:8080/foo/');
addressAndPort.address.correctForm(); // 'ffff::'
addressAndPort.port; // 8080
.fromUnsignedByteArray(bytes)
Convert an unsigned byte array to an Address6 object
Convert an unsigned byte array to an Address6 object
Address6
.fromArpa(ip6.arpa)
Convert an ip6.arpa address to an Address6 object
Convert an ip6.arpa address to an Address6 object
Address6
var address= Address6.fromArpa('e.f.f.f.3.c.2.6.f.f.f.e.6.6.8.e.1.0.6.7.9.4.e.c.0.0.0.0.1.0.0.2.ip6.arpa.');
address.correctForm(); // '2001:0:ce49:7601:e866:efff:62c3:fffe'
#bigInteger
Return the address as a BigInteger
Return the address as a BigInteger
BigInteger
#binaryZeroPad
Return a zero-padded base-2 string representation of the address
Return a zero-padded base-2 string representation of the address
String
var address = new Address6('2001:4860:4001:803::1011');
address.binaryZeroPad();
// '0010000000000001010010000110000001000000000000010000100000000011
// 0000000000000000000000000000000000000000000000000001000000010001'
#canonicalForm
Return the canonical form of the address
Return the canonical form of the address
String
#correctForm
Return the correct form of the address
Return the correct form of the address
String
#decimal
Return the decimal form of the address
Return the decimal form of the address
String
#endAddress
The last address in the range given by this address' subnet
The last address in the range given by this address' subnet
Address6
#getBits(start, end)
Return the bits in the given range as a BigInteger
Return the bits in the given range as a BigInteger
BigInteger
#getBitsBase16(start, end)
Return the bits in the given range as a base-16 string
Return the bits in the given range as a base-16 string
String
#getBitsBase2(start, end)
Return the bits in the given range as a base-2 string
Return the bits in the given range as a base-2 string
String
#getBitsPastSubnet
Return the bits that are set past the subnet mask length
Return the bits that are set past the subnet mask length
String
#getScope
Return the scope of the address
Return the scope of the address
String
#getType
Return the type of the address
Return the type of the address
String
#inspect6to4
Return an object containing the 6to4 properties of the address
Return an object containing the 6to4 properties of the address
Object
#inspectTeredo
Return an object containing the Teredo properties of the address
Return an object containing the Teredo properties of the address
Object
#is4
Returns true if the address is a v4-in-v6 address, false otherwise
Returns true if the address is a v4-in-v6 address, false otherwise
boolean
#is6to4
Returns true if the address is a 6to4 address, false otherwise
Returns true if the address is a 6to4 address, false otherwise
boolean
#isCanonical
Returns true if the address is in the canonical form, false otherwise
Returns true if the address is in the canonical form, false otherwise
boolean
#isCorrect
Returns true if the address is correct, false otherwise
Returns true if the address is correct, false otherwise
boolean
#isInSubnet
Returns true if the given address is in the subnet of the current address
Returns true if the given address is in the subnet of the current address
boolean
#isLinkLocal
Returns true if the address is a link local address, false otherwise
Returns true if the address is a link local address, false otherwise
boolean
#isLoopback
Returns true if the address is a loopback address, false otherwise
Returns true if the address is a loopback address, false otherwise
boolean
#isMulticast
Returns true if the address is a multicast address, false otherwise
Returns true if the address is a multicast address, false otherwise
boolean
#isTeredo
Returns true if the address is a Teredo address, false otherwise
Returns true if the address is a Teredo address, false otherwise
boolean
#isValid
Returns true if the address is valid, false otherwise
Returns true if the address is valid, false otherwise
boolean
#mask([mask], optionalMask)
Return the first n bits of the address, defaulting to the subnet mask
#microsoftTranscription
Return the Microsoft UNC transcription of the address
Return the Microsoft UNC transcription of the address
String
:
the Microsoft UNC transcription of the address
#possibleSubnets([size], optionalSubnetSize)
Return the number of possible subnets of a given size in the address
#regularExpression(optionalSubString, optionalSubstring)
Generate a regular expression that can be used to find or validate all variations of this address.
#regularExpressionString(optionalSubString)
Generate a regular expression string that can be used to find or validate all variations of this address
#reverseForm(options)
Return the reversed ip6.arpa form of the address
Return the reversed ip6.arpa form of the address
String
#startAddress
The first address in the range given by this address' subnet
The first address in the range given by this address' subnet
Address6
#to4
Return the last two groups of this address as an IPv4 address string
Return the last two groups of this address as an IPv4 address string
String
var address = new Address6('2001:4860:4001::1825:bf11');
address.to4(); // '24.37.191.17'
#to4in6
Return the v4-in-v6 form of the address
Return the v4-in-v6 form of the address
String
#to6to4
Return a v6 6to4 address from a v6 v4inv6 address
Return a v6 6to4 address from a v6 v4inv6 address
Address6
#toByteArray
Return a byte array
Return a byte array
Array
#toUnsignedByteArray
Return an unsigned byte array
Return an unsigned byte array
Array
Groups an address
String
String
:
the address in link form with a default port of 80
String
:
a link suitable for conveying the address via a URL hash
Groups an address
String
:
a grouped address
String
:
the string with each character contained in a
String
:
the string with leading zeroes contained in a
String
:
the string with all zeroes contained in a