Guava: InetAddresses.cidrRange

Created on 31 Oct 2014  路  5Comments  路  Source: google/guava

_Original issue created by adrian.f.cole on 2013-01-14 at 03:37 AM_


Seems the following should be possible to include, and save a lot of people parsing on their own. WDYT?

Range<InetAddress> slash22 = InetAddresses.cidrRange("198.51.100.0/22");
or..
Range<InetAddress> slash48 = InetAddresses.cidrRange("2001:db8::", 48);

P3 package=net status=triaged type=addition

Most helpful comment

Would also be nice if there was support for checking if a given IPv4/IPv6 address is in the range of a given Subnet. Something like the SubnetInfo isInRange method.

All 5 comments

Does anyone know what the state of this is? This seems very useful and I'd be interested in taking a stab at it if no-one is. I imagine it would be something similar to getAllAddresses in Apache Commons SubnetUtils: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/SubnetUtils.java?view=markup

:+1:

Would also be nice if there was support for checking if a given IPv4/IPv6 address is in the range of a given Subnet. Something like the SubnetInfo isInRange method.

We have a use case with the exact same need as the one described in the original issue. It would be fantastic to have Guava supporting CIDR to ranges computations for IPv4 and IPv6 addresses.

馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cowwoc picture cowwoc  路  3Comments

PhilippWendler picture PhilippWendler  路  4Comments

cpovirk picture cpovirk  路  5Comments

epkugelmass picture epkugelmass  路  4Comments

thecoop picture thecoop  路  4Comments