Search code examples
javavalidationipv6

Open source IPv6 Java validation


Now that all sun.* proprietary APIs may be removed in the future, does anyone know any open source Java implementation of IPv6 validation?

Regarding this question, it'd be also nice to have native ipv6-address/prefix-length format support to.


Solution

  • The open-source IPAddress Java library will validate both IPv6 and IPv4 and also supports prefix-length (and validation of such). I am the project manager of that library.

    Use

    try {
        IPAddressString str = new IPAddressString("::1");
        IPAddress addr = str.toAddress();
    } catch(IPAddressStringException e) {
        //e.getMessage has validation error
    }