Skip to content

Commit

Permalink
IPv6 address to cidr.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeyoung committed Nov 26, 2024
1 parent 46e01b4 commit b2d1f80
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@ static public String addressToCidr(String address) {
return rtn;
}

// get the cidr from an IPV6 address
static public String addressToCidrIPv6(String address) {
String rtn = null;
if(address != null && address.indexOf('/') > -1) {
inet.ipaddr.IPAddress subnetIpAddress = new inet.ipaddr.IPAddressString(address).getAddress();
rtn = subnetIpAddress.toPrefixBlock().toString();
}

return rtn;
}

static public String addressToSubnet(String address) {
String rtn = null;
if (address != null && address.indexOf('/') > -1) {
Expand Down

0 comments on commit b2d1f80

Please sign in to comment.