mirror of
https://github.com/nttgin/BGPalerter.git
synced 2024-05-19 06:50:08 +00:00
Merge branch 'release' into dev
This commit is contained in:
8
package-lock.json
generated
8
package-lock.json
generated
@@ -5181,11 +5181,11 @@
|
||||
}
|
||||
},
|
||||
"rpki-validator": {
|
||||
"version": "2.2.11",
|
||||
"resolved": "https://registry.npmjs.org/rpki-validator/-/rpki-validator-2.2.11.tgz",
|
||||
"integrity": "sha512-mrvIJJ2hmtLI4P0uKaZCsOUCR0M1glMFmzf3o/t047D5T2y4T33ho7ay5GrUdatn2E6BcaT1JLhBw82+HX9QBQ==",
|
||||
"version": "2.2.12",
|
||||
"resolved": "https://registry.npmjs.org/rpki-validator/-/rpki-validator-2.2.12.tgz",
|
||||
"integrity": "sha512-sv6MWMVmEKceha/hZdgZjghIQanI09e3j71r8pTowqAHGpq3FyRqv/WgztvfA3u5TOlCklBybifB0kz/xKW0+Q==",
|
||||
"requires": {
|
||||
"axios": "^0.21.0",
|
||||
"axios": "^0.21.1",
|
||||
"brembo": "^2.0.4",
|
||||
"ip-sub": "^1.0.19",
|
||||
"radix-trie-js": "^1.0.5"
|
||||
|
@@ -72,7 +72,7 @@
|
||||
"nodemailer": "^6.4.17",
|
||||
"path": "^0.12.7",
|
||||
"restify": "^8.5.1",
|
||||
"rpki-validator": "^2.2.11",
|
||||
"rpki-validator": "^2.2.12",
|
||||
"semver": "^7.3.4",
|
||||
"syslog-client": "^1.1.1",
|
||||
"ws": "^7.4.2",
|
||||
|
@@ -38,7 +38,7 @@ export default class ConnectorTest extends Connector{
|
||||
|
||||
constructor(name, params, env) {
|
||||
super(name, params, env);
|
||||
this.pubSub.subscribe("test-type", (type, message) => {
|
||||
this.pubSub.subscribe("test-type", (message, type) => {
|
||||
clearInterval(this.timer);
|
||||
this.subscribe({type: message});
|
||||
});
|
||||
|
@@ -55,10 +55,7 @@ export default class Consumer {
|
||||
});
|
||||
}
|
||||
process.on('message', this.dispatch);
|
||||
env.pubSub.subscribe('data', (type, data) => {
|
||||
this.dispatch(data);
|
||||
});
|
||||
|
||||
env.pubSub.subscribe('data', this.dispatch);
|
||||
};
|
||||
|
||||
dispatch = (buffer) => {
|
||||
|
@@ -121,7 +121,7 @@ export default class Input {
|
||||
getMoreSpecificMatch = (prefix, includeIgnoredMorespecifics) => {
|
||||
|
||||
for (let p of this.prefixes) {
|
||||
if (ipUtils.isEqualPrefix(p.prefix, prefix)) {
|
||||
if (ipUtils._isEqualPrefix(p.prefix, prefix)) {
|
||||
return p;
|
||||
} else {
|
||||
|
||||
|
@@ -57,7 +57,7 @@ export default class MonitorHijack extends Monitor {
|
||||
const message = alerts[0].matchedMessage;
|
||||
const asnText = matchedRule.asn;
|
||||
|
||||
return (ipUtils.isEqualPrefix(message.prefix, matchedRule.prefix)) ?
|
||||
return (ipUtils._isEqualPrefix(message.prefix, matchedRule.prefix)) ?
|
||||
`The prefix ${matchedRule.prefix} (${matchedRule.description}) is announced by ${message.originAS} instead of ${asnText}` :
|
||||
`A new prefix ${message.prefix} is announced by ${message.originAS}. ` +
|
||||
`It should be instead ${matchedRule.prefix} (${matchedRule.description}) announced by ${asnText}`;
|
||||
@@ -82,7 +82,6 @@ export default class MonitorHijack extends Monitor {
|
||||
|
||||
monitor = (message) =>
|
||||
new Promise((resolve, reject) => {
|
||||
|
||||
const messagePrefix = message.prefix;
|
||||
const matchedRule = this.getMoreSpecificMatch(messagePrefix, false);
|
||||
|
||||
|
@@ -70,7 +70,7 @@ export default class MonitorNewPrefix extends Monitor {
|
||||
|
||||
if (matchedRule && !matchedRule.ignore &&
|
||||
matchedRule.asn.includes(message.originAS) &&
|
||||
!ipUtils.isEqualPrefix(matchedRule.prefix, messagePrefix)) {
|
||||
!ipUtils._isEqualPrefix(matchedRule.prefix, messagePrefix)) {
|
||||
|
||||
this.publishAlert(message.originAS.getId() + "-" + message.prefix,
|
||||
matchedRule.asn.getId(),
|
||||
|
@@ -77,7 +77,7 @@ export default class MonitorVisibility extends Monitor {
|
||||
const messagePrefix = message.prefix;
|
||||
const matchedRule = this.getMoreSpecificMatch(messagePrefix, false);
|
||||
|
||||
if (matchedRule && !matchedRule.ignore && ipUtils.isEqualPrefix(matchedRule.prefix, messagePrefix)) {
|
||||
if (matchedRule && !matchedRule.ignore && ipUtils._isEqualPrefix(matchedRule.prefix, messagePrefix)) {
|
||||
|
||||
let key = matchedRule.prefix;
|
||||
|
||||
|
@@ -46,7 +46,7 @@ export default class Report {
|
||||
this.params = params;
|
||||
|
||||
for (let channel of channels){
|
||||
env.pubSub.subscribe(channel, (message, content) => {
|
||||
env.pubSub.subscribe(channel, (content, message) => {
|
||||
return this.report(message, content);
|
||||
});
|
||||
}
|
||||
|
@@ -101,5 +101,5 @@ export default class WebSocket {
|
||||
};
|
||||
|
||||
|
||||
on = (event, callback) => this.pubsub.subscribe(event, (_, data) => callback(data));
|
||||
on = (event, callback) => this.pubsub.subscribe(event, callback);
|
||||
}
|
@@ -9,10 +9,9 @@ export default class PubSub {
|
||||
};
|
||||
|
||||
publish(channel, content) {
|
||||
const callbacks = this.callbacks[channel] || [];
|
||||
for (let clb of callbacks) {
|
||||
for (let clb of this.callbacks[channel] || []) {
|
||||
new Promise(function(resolve, reject){
|
||||
clb(channel, content);
|
||||
clb(content, channel);
|
||||
resolve(true);
|
||||
})
|
||||
.catch(console.log);
|
||||
|
@@ -210,7 +210,7 @@ describe("Core functions", function() {
|
||||
const worker = require("../index");
|
||||
const pubSub = worker.pubSub;
|
||||
|
||||
pubSub.subscribe("software-update", function (type, message) {
|
||||
pubSub.subscribe("software-update", function (message, type) {
|
||||
expect(type).to.equal("software-update");
|
||||
done();
|
||||
});
|
||||
|
@@ -69,7 +69,7 @@ describe("Alerting", function () {
|
||||
};
|
||||
|
||||
let visibilityTestCompleted = false;
|
||||
pubSub.subscribe("visibility", (type, message) => {
|
||||
pubSub.subscribe("visibility", (message, type) => {
|
||||
try {
|
||||
if (!visibilityTestCompleted) {
|
||||
message = JSON.parse(JSON.stringify(message));
|
||||
@@ -189,7 +189,7 @@ describe("Alerting", function () {
|
||||
}
|
||||
};
|
||||
let hijackTestCompleted = false
|
||||
pubSub.subscribe("hijack", (type, message) => {
|
||||
pubSub.subscribe("hijack", (message, type) => {
|
||||
try {
|
||||
if (!hijackTestCompleted) {
|
||||
message = JSON.parse(JSON.stringify(message));
|
||||
@@ -336,7 +336,7 @@ describe("Alerting", function () {
|
||||
};
|
||||
|
||||
let newprefixTestCompleted = false;
|
||||
pubSub.subscribe("newprefix", (type, message) => {
|
||||
pubSub.subscribe("newprefix", (message, type) => {
|
||||
try {
|
||||
if (!newprefixTestCompleted) {
|
||||
message = JSON.parse(JSON.stringify(message));
|
||||
@@ -462,7 +462,7 @@ describe("Alerting", function () {
|
||||
};
|
||||
|
||||
let pathTestCompleted = false;
|
||||
pubSub.subscribe("path", (type, message) => {
|
||||
pubSub.subscribe("path", (message, type) => {
|
||||
try {
|
||||
if (!pathTestCompleted) {
|
||||
message = JSON.parse(JSON.stringify(message));
|
||||
@@ -515,7 +515,7 @@ describe("Alerting", function () {
|
||||
};
|
||||
|
||||
let misconfigurationTestCompleted = false;
|
||||
pubSub.subscribe("misconfiguration", (type, message) => {
|
||||
pubSub.subscribe("misconfiguration", (message, type) => {
|
||||
|
||||
if (!misconfigurationTestCompleted) {
|
||||
try {
|
||||
@@ -559,7 +559,7 @@ describe("Alerting", function () {
|
||||
}
|
||||
}, 15000);
|
||||
|
||||
pubSub.subscribe("visibility", function (type, message) {
|
||||
pubSub.subscribe("visibility", function (message, type) {
|
||||
notReceived = false;
|
||||
});
|
||||
pubSub.publish("test-type", "fade-off");
|
||||
|
@@ -49,7 +49,7 @@ describe("Composition", function() {
|
||||
describe("Software updates check", function () {
|
||||
it("new version detected with proxy", function (done) {
|
||||
|
||||
pubSub.subscribe("software-update", function (type, message) {
|
||||
pubSub.subscribe("software-update", function (message, type) {
|
||||
expect(type).to.equal("software-update");
|
||||
done();
|
||||
});
|
||||
|
@@ -70,7 +70,7 @@ describe("RPKI monitoring 1", function() {
|
||||
|
||||
let rpkiTestCompleted = false;
|
||||
let started = false;
|
||||
pubSub.subscribe("rpki", function (type, message) {
|
||||
pubSub.subscribe("rpki", function (message, type) {
|
||||
try {
|
||||
if (started && !rpkiTestCompleted) {
|
||||
message = JSON.parse(JSON.stringify(message));
|
||||
|
@@ -63,7 +63,7 @@ describe("RPKI monitoring 3", function() {
|
||||
let rpkiTestCompletedExternal = false;
|
||||
let started = false;
|
||||
|
||||
pubSub.subscribe("rpki", function (type, message) {
|
||||
pubSub.subscribe("rpki", function (message, type) {
|
||||
try {
|
||||
if (started && !rpkiTestCompletedExternal) {
|
||||
message = JSON.parse(JSON.stringify(message));
|
||||
|
@@ -67,7 +67,7 @@ describe("RPKI monitoring 4", function() {
|
||||
};
|
||||
|
||||
let rpkiTestCompletedExternal = false;
|
||||
pubSub.subscribe("rpki", function (type, message) {
|
||||
pubSub.subscribe("rpki", function (message, type) {
|
||||
|
||||
try {
|
||||
if (!rpkiTestCompletedExternal) {
|
||||
|
@@ -64,7 +64,7 @@ describe("RPKI monitoring 2", function() {
|
||||
let rpkiTestCompletedExternal = false;
|
||||
let started = false;
|
||||
|
||||
pubSub.subscribe("rpki", function (type, message) {
|
||||
pubSub.subscribe("rpki", function (message, type) {
|
||||
try {
|
||||
if (started && !rpkiTestCompletedExternal) {
|
||||
message = JSON.parse(JSON.stringify(message));
|
||||
|
Reference in New Issue
Block a user