Skip to content

Commit

Permalink
ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasnz committed Oct 13, 2023
1 parent 57b341f commit 9d0ae16
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/model/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class Monitor extends BeanModel {

try {
if (this.type === "ping" || this.type === "port" || this.type === "dns" ) {
if (this.ipFamily == 4 || this.ipFamily == 6) {
if (this.ipFamily === 4 || this.ipFamily === 6) {
try {
let lookup;
if (this.type === "dns") {
Expand All @@ -360,7 +360,7 @@ class Monitor extends BeanModel {
}
const [ address, family ] = await Monitor.lookup(lookup, this.ipFamily);
log.debug("monitor", `hostname: ${lookup}, ipFamily: ${this.ipFamily}, address: ${address}, family: ${family}`);
if (this.ipFamily != family) {
if (this.ipFamily !== family) {
throw "Error: Incorrect IP family.";
}
if (this.type === "dns") {
Expand Down Expand Up @@ -1563,6 +1563,12 @@ class Monitor extends BeanModel {
return parent.active && parentActive;
}

/**
* lookup the hostname and return a single IP Address of the specified IP address family.
* @param {string} hostname hostname to lookup
* @param {int} family valid values are 4 or 6 - for IPv4 or IPv6 respectively
* @returns [ {string} address, {int} family] the resolved address and IP address family
*/
static async lookup(hostname, family) {
return new Promise((resolve, reject) => {
const options = {
Expand Down

0 comments on commit 9d0ae16

Please sign in to comment.