Browse Source

validate if port param existed

develop
ray-1337 3 years ago
parent
commit
259454ef33
  1. 2
      src/methods/allow.js
  2. 2
      src/methods/deny.js

2
src/methods/allow.js

@ -59,9 +59,11 @@ module.exports.address = async function (address, port, protocol) {
if (!checkAddress) return false;
// port validation
if (port) {
if (typeof port !== "number") throw new Error("The port must be type of number.");
let checkPort = util.checkAppropriatePort(port);
if (!checkPort) return false;
};
// protocol (tcp/udp) validation
if (protocol) {

2
src/methods/deny.js

@ -59,9 +59,11 @@ module.exports.address = async function (address, port, protocol) {
if (!checkAddress) return false;
// port validation
if (port) {
if (typeof port !== "number") throw new Error("The port must be type of number.");
let checkPort = util.checkAppropriatePort(port);
if (!checkPort) return false;
};
// protocol (tcp/udp) validation
if (protocol) {

Loading…
Cancel
Save