api/keys: fix prefix size calculation for individual ipv6 addresses

This commit is contained in:
dumbmoron 2024-10-12 11:24:29 +00:00
parent 9f4f03ec6c
commit 7c0fb16fdb
No known key found for this signature in database

View file

@ -99,7 +99,9 @@ const formatKeys = (keyData) => {
if (data.ips) { if (data.ips) {
formatted[key].ips = data.ips.map(addr => { formatted[key].ips = data.ips.map(addr => {
if (ip.isValid(addr)) { if (ip.isValid(addr)) {
return [ ip.parse(addr), 32 ]; const parsed = ip.parse(addr);
const range = parsed.kind() === 'ipv6' ? 128 : 32;
return [ parsed, range ];
} }
return ip.parseCIDR(addr); return ip.parseCIDR(addr);