InetAddress

Object that contains all information about network address

Instance attributes

address: String

IP address

family: String

Internet address, one of:

  • inet

  • inet6

  • unspec

isAnyLocal: bool

TRUE if address is a wildcard address

isBroadcast: bool

TRUE if address is a broadcast address

isLinkLocal: bool

TRUE if address is a link local address

isLoopback: bool

TRUE if address is a loopback address

isMulticast: bool

TRUE if address is a multicast address

isSubnetBase: bool

TRUE if address is a subnet base address

isSubnetBroadcast: bool

TRUE if address is a subnet broadcast address

isValid: bool

TRUE if address valid

isValidUnicast: bool

TRUE if address valid unicast

mask: int

Address bit mask

subnet ⇒ InetAddress

Subnet base address

Instance methods

contains(address): bool

If subnet contains internet address. This object must hold the subnet base address (with mask), as in the example below.

Table 1. Parameters

address

InetAddress or String

Address to check for

Return

TRUE if contains, otherwise FALSE

r = InetAddress("192.168.56.0", 24).contains($node.ipAddress);
println(r); // will print "true", if primary IP address of node is in that subnet
equals(address): bool

If addresses are equal

Table 2. Parameters

address

InetAddress or String

Address to check to

Return

TRUE if addresses are equal, otherwise FALSE

inRange(addressStart, addressEnd): bool

If address is in range (inclusive). Always FALSE if address families differ.

r = $node.ipAddress.inRange(InetAddress("192.168.56.10"), InetAddress("192.168.56.20"));
println(r); // will print "true", if primary IP address of node is in range
Table 3. Parameters

addressStart

InetAddress or String

Start of the range address

addressEnd

InetAddress or String

End of the range address

Return

TRUE if adresse is in range, otherwise FALSE

sameSubnet(address): bool

If adresses are in the same subnet (using mask bits from this InetAddress)

Table 4. Parameters

address

InetAddress

IP address

Return

TRUE if adresses are in the same subnet, otherwise FALSE

Constructors

InetAddress()

Constructor for internet address. Creates an invalid address (family unspec)

Return

InetAddress object

InetAddress(address, mask)

Constructor for internet address

Table 5. Parameters

address

String

IP address as a string

mask

integer

mask in CIDR notation (optional parameter). Values out of range are limited to 0-32 for IPv4 and 0-128 for IPv6.

Return

InetAddress object