public class GlobalIP
extends java.lang.Object
GlobalIP is responsible for obtaining global IP address
of the host and checking if lies on in the selected IP range| Modifier and Type | Field and Description |
|---|---|
private static org.apache.log4j.Logger |
log
Used to log different events.
|
| Constructor and Description |
|---|
GlobalIP()
Creates a new instance of the class.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getGlobalAddress()
Finds this computer's global IP address.
|
private static long |
ipToLong(java.net.InetAddress ip)
Converts the IP address to a long value, which can be then compared.
|
static boolean |
isIPInRange(java.lang.String ipAddress,
java.lang.String lowBorder,
java.lang.String highBorder)
Checks if the IP address lies within the given range of IP addresses.
|
public static java.lang.String getGlobalAddress()
private static long ipToLong(java.net.InetAddress ip)
ip - the IP address to be convertedpublic static boolean isIPInRange(java.lang.String ipAddress,
java.lang.String lowBorder,
java.lang.String highBorder)
ipAddress - IP address to be checkedlowBorder - lower border of the rangehighBorder - higher border of the rangetrue if the IP address is within the range, false otherwise