1
0
mirror of https://github.com/nttgin/BGPalerter.git synced 2024-05-19 06:50:08 +00:00

moved sanitizePrefixList in order to be executed once

This commit is contained in:
Massimo Candela
2020-01-20 18:26:56 +01:00
parent f5d6c9b7de
commit 009527c44f
2 changed files with 4 additions and 3 deletions

View File

@@ -58,7 +58,8 @@ export default class Input {
sanitizePrefixList = () => {
this.prefixes.forEach(item => {
if (item.prefix.includes(':')){
item.prefix = ipUtils.expandIPv6(item.prefix);
const components = item.prefix.split("/");
item.prefix = ipUtils.expandIPv6(components[0]) + '/' + components[1];
}
});
@@ -68,7 +69,6 @@ export default class Input {
};
getMonitoredLessSpecifics = () => {
this.sanitizePrefixList();
if (!this.prefixes.length) {
return [];
@@ -100,7 +100,6 @@ export default class Input {
};
getMoreSpecificMatch = (prefix) => {
this.sanitizePrefixList();
for (let p of this.prefixes) {
if (p.prefix === prefix) {

View File

@@ -223,10 +223,12 @@ export default class InputYml extends Input {
};
getMonitoredMoreSpecifics = () => {
this.sanitizePrefixList();
return this.prefixes.filter(p => !p.ignoreMorespecifics);
};
getMonitoredPrefixes = () => {
this.sanitizePrefixList();
return this.prefixes;
};