mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-28 18:46:09 +00:00
api/keys: fix prefix size calculation for individual ipv6 addresses
This commit is contained in:
parent
9f4f03ec6c
commit
7c0fb16fdb
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue