@Test public void testIpV4MatcherWithIpV6() throws UnknownHostException { netMatcher = new NetMatcher(DNSFixture.LOCALHOST_IP_V4_ADDRESSES, DNSFixture.DNS_SERVER_IPV4_MOCK); assertThat(netMatcher.matchInetNetwork("0:0:0:0:0:0:0:1%0")).isFalse(); assertThat(netMatcher.matchInetNetwork("00:00:00:00:00:00:00:1")).isFalse(); assertThat(netMatcher.matchInetNetwork("00:00:00:00:00:00:00:2")).isFalse(); assertThat(netMatcher.matchInetNetwork("2781:0db8:1234:8612:45ee:ffff:fffe:0001")).isFalse(); assertThat(netMatcher.matchInetNetwork("2781:0db8:1235:8612:45ee:ffff:fffe:0001")).isFalse(); }
public boolean matchInetNetwork(String hostIP) { InetAddress ip; try { ip = dnsServer.getByName(hostIP); } catch (UnknownHostException uhe) { LOGGER.info("Cannot resolve address for {}: {}", hostIP, uhe.getMessage()); return false; } return matchInetNetwork(ip); }
NetMatcher { public boolean matchInetNetwork(String hostIP) { InetAddress ip; try { ip = dnsServer.getByName(hostIP); } catch (UnknownHostException uhe) { LOGGER.info("Cannot resolve address for {}: {}", hostIP, uhe.getMessage()); return false; } return matchInetNetwork(ip); } }
NetMatcher { public boolean matchInetNetwork(String hostIP) { InetAddress ip; try { ip = dnsServer.getByName(hostIP); } catch (UnknownHostException uhe) { LOGGER.info("Cannot resolve address for {}: {}", hostIP, uhe.getMessage()); return false; } return matchInetNetwork(ip); } NetMatcher(String[] nets, DNSService dnsServer);  NetMatcher(Collection<String> nets, DNSService dnsServer);  NetMatcher(String commaSeparatedNets, DNSService dnsServer); }
NetMatcher { public boolean matchInetNetwork(String hostIP) { InetAddress ip; try { ip = dnsServer.getByName(hostIP); } catch (UnknownHostException uhe) { LOGGER.info("Cannot resolve address for {}: {}", hostIP, uhe.getMessage()); return false; } return matchInetNetwork(ip); } NetMatcher(String[] nets, DNSService dnsServer);  NetMatcher(Collection<String> nets, DNSService dnsServer);  NetMatcher(String commaSeparatedNets, DNSService dnsServer); boolean matchInetNetwork(String hostIP); boolean matchInetNetwork(InetAddress ip); @Override String toString(); }
NetMatcher { public boolean matchInetNetwork(String hostIP) { InetAddress ip; try { ip = dnsServer.getByName(hostIP); } catch (UnknownHostException uhe) { LOGGER.info("Cannot resolve address for {}: {}", hostIP, uhe.getMessage()); return false; } return matchInetNetwork(ip); } NetMatcher(String[] nets, DNSService dnsServer);  NetMatcher(Collection<String> nets, DNSService dnsServer);  NetMatcher(String commaSeparatedNets, DNSService dnsServer); boolean matchInetNetwork(String hostIP); boolean matchInetNetwork(InetAddress ip); @Override String toString(); static final String NETS_SEPARATOR; }