forked from mirrors/amnezia-wg-easy
Revert "feat: cidr notation"
This commit is contained in:
parent
cb63d5c67f
commit
bf214fb4d3
8 changed files with 29 additions and 44 deletions
|
@ -4,6 +4,19 @@ const childProcess = require('child_process');
|
|||
|
||||
module.exports = class Util {
|
||||
|
||||
static isValidIPv4(str) {
|
||||
const blocks = str.split('.');
|
||||
if (blocks.length !== 4) return false;
|
||||
|
||||
for (let value of blocks) {
|
||||
value = parseInt(value, 10);
|
||||
if (Number.isNaN(value)) return false;
|
||||
if (value < 0 || value > 255) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static promisify(fn) {
|
||||
// eslint-disable-next-line func-names
|
||||
return function(req, res) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue