From 5f8f49a459a90ddeb40d2d56b445cdf319dc79f3 Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <me@adhisimon.org> Date: Thu, 5 Dec 2019 15:45:38 +0700 Subject: [PATCH] modem.outgoing --- config.sample.json | 1 + lib/modems.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config.sample.json b/config.sample.json index baa5e68..78a1ad1 100644 --- a/config.sample.json +++ b/config.sample.json @@ -14,6 +14,7 @@ { "name": "SENDER-AS13", "disabled": true, + "outgoing": true, "imsi": null, "prefix": [] } diff --git a/lib/modems.js b/lib/modems.js index f2ee0ed..16f74f1 100644 --- a/lib/modems.js +++ b/lib/modems.js @@ -14,8 +14,13 @@ exports.enabledModems = (arrayOfModem) => { return modems.filter((modem) => !modem.disabled); }; +exports.outgoingModems = (arrayOfModem) => { + const modems = arrayOfModem || config.modems || []; + return modems.filter((modem) => !modem.disabled && modem.outgoing); +}; + exports.randomModem = (arrayOfModem) => { - const modems = this.enabledModems(arrayOfModem); + const modems = this.outgoingModems(arrayOfModem); const modemCount = modems.count; if (!modemCount) return null; -- 1.9.0