public static boolean isInPrivateAddressSpace(String ip) {
        InetAddress inetAddress = InetAddresses.forString(ip);
        if (inetAddress instanceof Inet6Address) {
            // Inet6Address#isSiteLocalAddress is wrong: it only checks for FEC0:: prefixes, which is deprecated in RFC 3879
            // instead we need to check for unique local addresses, which are in FC00::/7 (in practice assigned are in FD00::/8,
            // but the RFC allows others in the future)
            return UNIQUE_LOCAL_ADDR_MASK.contains(inetAddress);
        }
        return inetAddress.isSiteLocalAddress();
    }
@Test
    public void testIsInPrivateAddressSpace() throws Exception {
        assertTrue(PrivateNet.isInPrivateAddressSpace("10.0.0.1"));
        assertTrue(PrivateNet.isInPrivateAddressSpace("172.16.20.50"));
        assertTrue(PrivateNet.isInPrivateAddressSpace("192.168.1.1"));
        assertFalse(PrivateNet.isInPrivateAddressSpace("99.42.44.219"));
        assertFalse(PrivateNet.isInPrivateAddressSpace("ff02:0:0:0:0:0:0:fb"));
        assertTrue(PrivateNet.isInPrivateAddressSpace("fd80:0:0:0:0:0:0:fb"));
        assertThrows(IllegalArgumentException.class, () -> PrivateNet.isInPrivateAddressSpace("this is not an IP address"));
    }