aboutsummaryrefslogtreecommitdiff
path: root/api/lib/checkIfAllowedIP
diff options
context:
space:
mode:
Diffstat (limited to 'api/lib/checkIfAllowedIP')
-rw-r--r--api/lib/checkIfAllowedIP/index.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/api/lib/checkIfAllowedIP/index.js b/api/lib/checkIfAllowedIP/index.js
new file mode 100644
index 0000000..2e50418
--- /dev/null
+++ b/api/lib/checkIfAllowedIP/index.js
@@ -0,0 +1,9 @@
+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;