diff --git a/server/src/utils/subnetInfo.js b/server/src/utils/subnetInfo.js index 1145bc3..38789b8 100644 --- a/server/src/utils/subnetInfo.js +++ b/server/src/utils/subnetInfo.js @@ -9,7 +9,7 @@ const subNetsInfo = [ }, { shortName: 'RT', - name: 'Reitoria 2', + name: 'Reitoria', cidr: '10.1.0.0/16', addresses: [ { name: 'RNP', ip: '200.19.32.4' } @@ -97,9 +97,20 @@ export const subNets = subNetsInfo.map(subNetInfo => ({ })) export function getSubnetInfo(ip) { - if (isIPv4(ip)) return subNets.find(subnet => subnet.contains(ip)) - else return { - shortName: 'XX', - name: 'Desconhecido' - } + if (!isIPv4(ip)) + return { + shortName: '__', + name: 'Sem rede' + } + + + const subnet = subNets.find(subnet => subnet.contains(ip)) + + if (!subnet) + return { + shortName: '??', + name: 'Rede desconhecida' + } + + return subnet }