Skip to content

CIDRUtils is a Java library that enables you to get an IP range from CIDR specification. It support both IPv4 and IPv6.

Notifications You must be signed in to change notification settings

felfert/CIDRUtils

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CIDRUtils

This is a mavenized and improved version of the original. See forked link. CIDRUtils is a Java library that enables you to get an IP range from CIDR specification. It supports both IPv4 and IPv6. CIDRUtils is also distributed via Maven Central

IPv4 Example

CIDRUtils cidrUtils = new CIDRUtils("10.77.12.11/18");
String networkAddress = cidrUtils.getNetworkAddress();
String broadcastAddress = cidrUtils.getBroadcastAddress();

Evaluating the code above would produce 10.77.0.0 for the networkAddress and 10.77.63.255 for the broadcastAddress.

IPv6 Example

CIDRUtils cidrUtils = new CIDRUtils("435:23f::45:23/101");
String networkAddress = cidrUtils.getNetworkAddress();
String broadcastAddress = cidrUtils.getBroadcastAddress();

Evaluating the code above would produce 435:23f:0:0:0:0:0:0 for the networkAddress and 435:23f:0:0:0:0:7ff:ffff for the broadcastAddress.

License

CIDRUtils is released under MIT License.

About

CIDRUtils is a Java library that enables you to get an IP range from CIDR specification. It support both IPv4 and IPv6.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Java 100.0%