IP address manipulation library.
Treats IP addresses as arithmetic types.
Supports IPv4 32-bit unsigned int & IPv6 128-bit unsigned int.
Includes methods for arithmetic operations & bitwise operations,
and special collections for discrete sets.
// EXAMPLE
// Define 192.168.0.0/24
int maskBits = 24;
V4 networkAddress = Family.v4().parse("192.168.0.0");
// 255.255.255.0
V4 mask = Family.v4().subnets().masks().get(maskBits);
// 0.0.0.255
V4 maskComplement = mask.not();
// 192.168.0.255
V4 lastAddress = maskComplement.or(networkAddress);Libraries are published to Maven Central
<dependency>
<groupId>uk.ipfreely</groupId>
<artifactId>addresses</artifactId>
<version>${version}</version>
</dependency>implementation("uk.ipfreely:addresses:${version}")
Version numbers are three digits - the Java version, major version, minor version.
Requires JDK17+.
./code/mvnw -f code/pom.xml install