将 ipv6 转换为整数并在浏览器中打开

Convert ipv6 to integer and open in browser

将 ip 地址(尤其是 ipv4)转换为整数值(95.191.162.12 变为 160639438)是一种常见的做法。使用 ipv4,我可以在浏览器中打开整数值(通过键入 http(or whatever)://160639438),它会完美地工作。

我对 ipv6 进行了同样的尝试:http://[2a00:1450:4011:804::1001] 有效,但其整数表示 55827987829239171056733755306672132097 无效(我尝试打开 http://[55827987829239171056733755306672132097]http://55827987829239171056733755306672132097[55827987829239171056733755306672132097]:80, ETC。)。

有没有办法通过整数值寻址 ipv6 主机?

RFC3493 第 6.3 节建议在 inet_addr() 中有效的 IP 地址的纯整数形式在 IPv6 的等效函数 inet_pton() 中不再被接受。引用:

The inet_pton() function does not accept other formats (such as the octal numbers, hexadecimal numbers, and fewer than four numbers that inet_addr() accepts).