aboutsummaryrefslogtreecommitdiff
path: root/api/lib
diff options
context:
space:
mode:
Diffstat (limited to 'api/lib')
-rw-r--r--api/lib/akLogMessage/index.js4
-rw-r--r--api/lib/checkIfAllowedIP/index.js5
-rw-r--r--api/lib/storeIncomingIP/index.js4
3 files changed, 9 insertions, 4 deletions
diff --git a/api/lib/akLogMessage/index.js b/api/lib/akLogMessage/index.js
index 6dfb8f2..59a1300 100644
--- a/api/lib/akLogMessage/index.js
+++ b/api/lib/akLogMessage/index.js
@@ -1,7 +1,8 @@
const { spawn } = require('child_process');
const config = require('../../config')
-module.exports = (type, message) => {
+function akLogMessage(type, message)
+{
const command = spawn(
"ak-log",
["-m", "ak-daemon", type, message]
@@ -26,3 +27,4 @@ module.exports = (type, message) => {
console.log(`child process exited with code ${code}`);
});
};
+module.exports = akLogMessage;
diff --git a/api/lib/checkIfAllowedIP/index.js b/api/lib/checkIfAllowedIP/index.js
index d9693d9..2e50418 100644
--- a/api/lib/checkIfAllowedIP/index.js
+++ b/api/lib/checkIfAllowedIP/index.js
@@ -1,8 +1,9 @@
-
-module.exports = (address) => {
+function checkIfAllowedIP(address)
+{
var test_cjdns = /^fc[0-9a-z]{1,2}:([0-9a-z]{1,4}:){1,6}[0-9a-z]{1,4}/
var test_yggdrasil = /^2[0-9a-z]{1,2}:([0-9a-z]{1,4}:){1,6}[0-9a-z]{1,4}/
var test_yggdrasil_sub = /^3[0-9a-z]{1,2}:([0-9a-z]{1,4}:){1,6}[0-9a-z]{1,4}/
return (test_cjdns.test(address) || test_yggdrasil.test(address) || test_yggdrasil_sub.test(address)) ? true : false;
};
+module.exports = checkIfAllowedIP;
diff --git a/api/lib/storeIncomingIP/index.js b/api/lib/storeIncomingIP/index.js
index c45def6..72273d0 100644
--- a/api/lib/storeIncomingIP/index.js
+++ b/api/lib/storeIncomingIP/index.js
@@ -1,6 +1,8 @@
const fs = require("node:fs");
const config = require("../../config");
-module.exports = (ip_address) => {
+function storeIncomingIP(ip_address)
+{
fs.appendFileSync(`${config.peersDir}/incomingRequests`, `${ip_address}\n`);
}
+module.exports = storeIncomingIP;