Methods for converting to and from Address instances.
Static methods
staticall (family:IpFamily):Address
Returns the IP address representing all hosts for the given IP family.
- For IPv4, the address is
0.0.0.0. - For IPv6, the address is
::.
staticequals (a:Address, b:Address, ipv6mapped:Bool = false):Bool
Returns true if a and b are the same IP address.
If ipv6mapped is true, bot a and b are mapped to IPv6 (using
mapToIpv6) before the comparison.
staticlocalhost (family:IpFamily):Address
Returns the IP address representing the local hosts for the given IP family.
- For IPv4, the address is
127.0.0.1. - For IPv6, the address is
::1.
staticmapToIpv6 (address:Address):Address
Returns the IPv6 version of the given address. IPv6 addresses are
returned unmodified, IPv4 addresses are mapped to IPv6 using the
:ffff:0:0/96 IPv4 transition prefix.
"127.0.0.1".toIpv4().mapToIpv6().toString(); // ::ffff:7f00:1