Package org.platformlayer.ops.networks

Examples of org.platformlayer.ops.networks.IpRange


          for (AddressModel net : network.getNetworks()) {
            if (Strings.isNullOrEmpty(net.cidr)) {
              continue;
            }

            IpRange cidr = IpRange.parse(net.cidr);
            if (!cidr.isIpv6()) {
              continue;
            }

            return new NetworkPoolBuilder(net.cidr, skipCount, net);
          }
View Full Code Here


        throw new IllegalStateException("Error parsing IP address: " + line);
      }
      addresses.add(address);
    }

    IpRange publicIpv6 = IpRange.parse("2000::/3");
    for (Inet6Address address : addresses) {
      if (publicIpv6.isInRange(address)) {
        return address;
      }
    }

    return null;
View Full Code Here

    List<Transport> transports;

    if (transport == null) {
      String cidr = sourceCidr;
      if (!Strings.isNullOrEmpty(sourceCidr)) {
        IpRange range = IpRange.parse(cidr);
        if (range.isIpv6()) {
          transport = Transport.Ipv6;
        } else {
          transport = Transport.Ipv4;
        }
      }
View Full Code Here

    } else {
      addressModel.copyFrom(this.addressModel);

      addressModel.address = key;

      IpRange netmask;
      if (!Strings.isNullOrEmpty(addressModel.netmask)) {
        netmask = IpRange.parse(addressModel.netmask);
      } else {
        netmask = this.range;
      }

      String cidr = addressModel.address + "/" + netmask.getNetmaskLength();
      addressModel.cidr = cidr;

      AddressModels.populateDefaults(addressModel);
    }
    return addressModel;
View Full Code Here

  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;
    }
  }
View Full Code Here

TOP

Related Classes of org.platformlayer.ops.networks.IpRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.