Esempio n. 1
0
 public static boolean isValidIp6Cidr(String ip6Cidr) {
   try {
     IPv6Network network = IPv6Network.fromString(ip6Cidr);
   } catch (IllegalArgumentException ex) {
     return false;
   }
   return true;
 }
Esempio n. 2
0
 public static int getIp6CidrSize(String ip6Cidr) {
   IPv6Network network = null;
   try {
     network = IPv6Network.fromString(ip6Cidr);
   } catch (IllegalArgumentException ex) {
     return 0;
   }
   return network.getNetmask().asPrefixLength();
 }
Esempio n. 3
0
 public static boolean isIp6InNetwork(String ip6, String ip6Cidr) {
   IPv6Network network = null;
   try {
     network = IPv6Network.fromString(ip6Cidr);
   } catch (IllegalArgumentException ex) {
     return false;
   }
   IPv6Address ip = IPv6Address.fromString(ip6);
   return network.contains(ip);
 }