public static boolean isPublic(InetAddress address) {
if (isIpv6(address)) {
return true;
} else {
IpRange private10 = IpRange.parse("10.0.0.0/8");
IpRange private17216 = IpRange.parse("172.16.0.0/12");
IpRange private192168 = IpRange.parse("192.168.0.0/16");
if (private10.isInRange(address)) {
return false;
}
if (private17216.isInRange(address)) {
return false;
}
if (private192168.isInRange(address)) {
return false;
}
return true;
}
}