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:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user