List of utility methods to do IP Address Match
boolean | checkIPMatching(String pattern, String address) check if IP address match pattern if (pattern.equals("*.*.*.*") || pattern.equals("*")) return true; String[] mask = pattern.split("\\."); String[] ip_address = address.split("\\."); for (int i = 0; i < mask.length; i++) { if (mask[i].equals("*") || mask[i].equals(ip_address[i])) continue; else if (mask[i].contains("-")) { ... |
boolean | checkIPv6Match(String ipTemplateList, String ipStr) Checks if the passed IPv6 complies to a given pattern. String[] chk = ipStr.split(REGEX_COLON); if (chk.length != OCTUPLE_LEN) { throw new IllegalArgumentException("Illegal IPv6 address: " + ipStr); boolean inverse = false; String[] ipTemplateArr = ipTemplateList.split(","); for (String anIpTemplateArr : ipTemplateArr) { String t; ... |