Was this page helpful?
Caution
You're viewing documentation for an unstable version of ScyllaDB Node.js Driver. Switch to the latest stable version.
InetAddress¶
types~InetAddress(buffer)
Represents an IP address.
Constructor¶
new InetAddress(buffer)
Creates an instance of InetAddress.
Parameters:
| Name | Type | Description |
|---|---|---|
buffer |
The buffer containing the IPv4 or IPv6 address. |
Throws:
If the buffer is not a valid IPv4 or IPv6 address.
Members¶
(readonly) buffer
Immutable buffer that represents the IP address
(readonly) length
Returns the length of the underlying buffer
(readonly) version
Returns the Ip version (4 or 6)
Methods¶
()
Validates for a IPv4-Mapped IPv6 according to https://tools.ietf.org/html/rfc4291#section-2.5.5
equals()
Compares 2 addresses and returns true if the underlying bytes are the same
getBuffer()
Returns the underlying buffer
inspect()
Provide the name of the constructor and the string representation
toJSON()
Returns the string representation. Method used by the native JSON.stringify() to serialize this instance.
toString()
Returns the string representation of the IP address.
For v4 IP addresses, a string in the form of d.d.d.d is returned.
For v6 IP addresses, a string in the form of x:x:x:x:x:x:x:x is returned, where the 'x's are the hexadecimal values of the eight 16-bit pieces of the address, according to rfc5952. In cases where there is more than one field of only zeros, it can be shortened. For example, 2001:0db8:0:0:0:1:0:1 will be expressed as 2001:0db8::1:0:1.
(static) fromString(value)
Converts a string representation of an IP address to an InetAddress instance.
This function accepts both IPv4 and IPv6 addresses, which may include an embedded IPv4 address.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
Throws:
-
- If the input string is not a valid IPv4 or IPv6 address.
- Type
- TypeError