IpAddr
- typeIpAddr
An IP address.
Can be either IPv4 or IPv6.
For IPv4, only dot-separated quad notation is supported.
Roto// IPv4 examples let a = 127.0.0.1; let b = 0.0.0.0; let c = 255.255.255.255; // IPv6 examples let d = 0:0:0:0:0:0:0:1; let e = ::1; let f = ::;
- constantLOCALHOSTV4: IpAddr
The IPv4 address pointing to localhost:
127.0.0.1
- constantLOCALHOSTV6: IpAddr
The IPv6 address pointing to localhost:
::1
- functioneq(self: IpAddr, other: IpAddr) bool
Check whether two IP addresses are equal.
A more convenient but equivalent method for checking equality is via the
==operator.An IPv4 address is never equal to an IPv6 address. IP addresses are considered equal if all their bits are equal.
Rotolet a = 192.0.0.0 == 192.0.0.0; // -> true let b = ::0 == ::0; // -> true let c = 192.0.0.0 == 192.0.0.1; // -> false let d = 0.0.0.0 == 0::0; // -> false // or equivalently: let e = 192.0.0.0.eq(192.0.0.0); // -> true
- functionis_ipv4(self: IpAddr) bool
Returns true if this address is an IPv4 address, and false otherwise.
Rotolet a = 1.1.1.1.is_ipv4(); // -> true let b = ::.is_ipv4(); // -> false
- functionis_ipv6(self: IpAddr) bool
Returns true if this address is an IPv6 address, and false otherwise.
Rotolet a = 1.1.1.1.is_ipv6(); // -> false let b = ::.is_ipv6(); // -> true