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