diff --git a/src/Util.js b/src/Util.js index 34688f1..54a2fe6 100644 --- a/src/Util.js +++ b/src/Util.js @@ -87,11 +87,7 @@ module.exports.checkAppropriateIP = function(address) { // https://blog.markhatton.co.uk/2011/03/15/regular-expressions-for-ip-addresses-cidr-ranges-and-hostnames/ // also support subnet/net mask let regex = new RegExp(/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(3[0-2]|[1-2][0-9]|[0-9]))?$/gi); - if (!address.match(regex)) { - throw new Error(`The IP address is not matched with ${regex.toString()} regular expressions.`); - }; - - return true; + return address.match(regex) !== null ? true : false; }; // soon to be continued