IPAddress class

Constructors

IPAddress(IpBits ip_bits, BigInt host_address, Prefix prefix, IPAddress? mapped, VtBool vt_is_private, VtBool vt_is_loopback, VtIPAddress vt_to_ipv6)

Properties

hashCode int
The hash code for this object.
no setterinherited
host_address BigInt
final
ip_bits IpBits
final
mapped IPAddress?
final
prefix Prefix
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
vt_is_loopback VtBool
final
vt_is_private VtBool
final
vt_to_ipv6 VtIPAddress
final

Methods

add(IPAddress other) List<IPAddress>
bits() String
Returns the address portion of an IP in binary format, as a string containing a sequence of 0 and 1
broadcast() IPAddress
Returns the broadcast address for the given IP.
change_netmask(String my_str) → Result<IPAddress, String>
change_prefix(Prefix prefix) → Result<IPAddress, String>
Set a prefix number for the object
change_prefix_int(int num) → Result<IPAddress, String>
clone() IPAddress
compare(IPAddress oth) int
dns_networks() List<IPAddress>
dns_parts() List<int>
dns_rev_domains() List<String>
Returns the IP address in in-addr.arpa format for DNS Domain definition entries like SOA Records
dns_reverse() String
each(Each func) → void
Iterates over all the IP addresses for the given network (or IP address).
each_host(Each func) → dynamic
Iterates over all the hosts IP addresses for the given network (or IP address).
equal(IPAddress other) bool
equals(Object oth) bool
first() IPAddress
Returns a IPv4 object with the first host IP address in the range.
from(BigInt addr, Prefix prefix) IPAddress
gt(IPAddress ipa) bool
includes(IPAddress oth) bool
Checks whether a subnet includes the given IP address.
includes_all(List<IPAddress> oths) bool
Checks whether a subnet includes all the given IPv4 objects.
ip_same_kind(IPAddress oth) bool
is_ipv4() bool
True if the object is an IPv4 address
is_ipv6() bool
True if the object is an IPv6 address
is_loopback() bool
Returns true if the address is a loopback address
is_mapped() bool
Returns true if the address is a mapped address
is_network() bool
Checks if the IP address is actually a network
is_private() bool
Checks if an IPv4 address objects belongs to a private network RFC1918
is_same_kind(IPAddress oth) bool
is_unspecified() bool
Returns true if the address is an unspecified address
last() IPAddress
Like its sibling method IPv4/// first, this method returns a IPv4 object with the last host IP address in the range.
lt(IPAddress ipa) bool
netmask() IPAddress
network() IPAddress
Returns a IPv4 object with the network number for the given IP.
newprefix(int num) → Result<Prefix, String>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parts() List<int>
parts_hex_str() List<String>
setMapped(BigInt hostAddr, IPAddress? mapped, Prefix prefix) IPAddress
setMappedIpaddress(IPAddress? mapped) IPAddress
size() BigInt
Spaceship operator to compare IPv4 objects
split(int subnets) → Result<List<IPAddress>, String>
sub(IPAddress other) BigInt
subnet(int subprefix) → Result<List<IPAddress>, String>
This method implements the subnetting function similar to the one described in RFC3531.
supernet(int new_prefix) → Result<IPAddress, String>
Returns a IPv4 object from the supernetting of the instance network.
to_hex() String
to_ipv6() IPAddress
Return the ip address in a format compatible with the IPv6 Mapped IPv4 addresses
to_s() String
to_s_mapped() String
to_s_uncompressed() String
to_s_vec(List<IPAddress> vec) Iterable<String>
to_string() String
Returns a string with the IP address in canonical form.
to_string_mapped() String
to_string_uncompressed() String
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

RE_IPV4 RegExp
final
RE_IPV6 RegExp
final
RE_MAPPED RegExp
final

Static Methods

aggregate(List<IPAddress> networks) List<IPAddress>
is_valid(String addr) bool
Checks if the given string is a valid IP address, either IPv4 or IPv6
is_valid_ipv4(String addr) bool
is_valid_ipv6(String addr) bool
is_valid_netmask(String addr) bool
Returns the prefix portion of the IPv4 object as a IPAddress::Prefix32 object
netmask_to_prefix(BigInt nm, int bits) → Result<int, String>
parse(String str) → Result<IPAddress, String>
Parse the argument string to create a new IPv4, IPv6 or Mapped IP object
parse_ipv4_part(String i, String addr) → Result<int, String>
Checks if the given string is a valid IPv4 address
parse_netmask_to_prefix(String my_str) → Result<int, String>
parseInt(String s, int radix) int?
pos_to_idx(int pos, int len) int
private helper for summarize assumes that networks is output from reduce_networks means it should be sorted lowers first and uniq
sort(List<IPAddress> ipas) List<IPAddress>
split_at_slash(String str) AddrNetmask
split_on_colon(String addr) → Result<SplitOnColon, String>
Checks if the given string is a valid IPv6 address
split_to_num(String addr) → Result<BigInt, String>
split_to_u32(String addr) → Result<int, String>
sum_first_found(List<IPAddress> arr) List<IPAddress>
Splits a network into different subnets
summarize(List<IPAddress> networks) List<IPAddress>
Summarization (or aggregation) is the process when two or more networks are taken together to check if a supernet, including all and only these networks, exists. If it exists then this supernet is called the summarized (or aggregated) network.
summarize_str(List<String> netstr) → Result<List<IPAddress>, String>
to_ipaddress_vec(List<String> vec) → Result<List<IPAddress>, String>
to_network(BigInt adr, int host_prefix) BigInt
to_string_vec(List<IPAddress> vec) List<String>