Skip to content

Latest commit

 

History

History
141 lines (102 loc) · 2.85 KB

inetaddress.adoc

File metadata and controls

141 lines (102 loc) · 2.85 KB

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 ⇒ Boolean

TRUE if address is a wildcard address

isBroadcast ⇒ Boolean

TRUE if address is a broadcast address

isLinkLocal ⇒ Boolean

TRUE if address is a link local address

isLoopback ⇒ Boolean

TRUE if address is a loopback address

isMulticast ⇒ Boolean

TRUE if address is a multicast address

isSubnetBase ⇒ Boolean

TRUE if address is a subnet base address

isSubnetBroadcast ⇒ Boolean

TRUE if address is a subnet broadcast address

isValid ⇒ Boolean

TRUE if address valid

isValidUnicast ⇒ Boolean

TRUE if address valid unicast

mask ⇒ Integer

Address bit mask

subnet ⇒ InetAddress

Subnet base address

Instance methods

contains(address) ⇒ void

If subnet contains internet address

Table 1. Parameters

address

InetAddress

Address to check for

Return

TRUE if contains, otherwise FALSE

Example
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) ⇒ void

If addresses are equal

Table 2. Parameters

address

InetAddress

Address to check to

Return

TRUE if addresses are equal, otherwise FALSE

inRange(addressStart, addressEnd) ⇒ void

If address is in range

Example
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

Start of the range address

addressEnd

InetAddress

End of the range address

Return

TRUE if adresse is in range, otherwise FALSE

sameSubnet(address) ⇒ void

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

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)

Return

InetAddress object