aboutsummaryrefslogtreecommitdiff
path: root/api/lib/checkIfAllowedIP/index.js
blob: d9693d911e7f9d585f7746c3da79015d66559f1b (plain)
1
2
3
4
5
6
7
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;
};