Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function pingSecureNode() {
if (isValidDomainName(settings.secureNodeFQDN)) {
let ping = require('ping');
const isIp = require('is-ip');
let fqdnIsV6 = isIp.v6(settings.secureNodeFQDN);
let cfg = {
v6: fqdnIsV6,
};
let hosts = [settings.secureNodeFQDN];
hosts.forEach(function (host) {
ping.sys.probe(host, function (isAlive) {
toggleLedHTML();
if (ledWrapperExists()){
if (isAlive) {
document.getElementById("dotSNstatus").style.backgroundColor = "#34A853"; // green #34A853
} else {
document.getElementById("dotSNstatus").style.backgroundColor = "#EA4335"; // red #EA4335
document.getElementById("dotSNstatusRPC").style.backgroundColor = "#EA4335"; // red #EA4335
}
normalize(typeHash, hash) {
const ip = hash.IP;
if (isIp.v6(ip)) {
hash.IP = `[${ip}]`;
}
const reservedPorts = (hash.ReservedPorts || []).map(port => ({
name: port.Label,
port: port.Value,
to: port.To,
isDynamic: false,
}));
const dynamicPorts = (hash.DynamicPorts || []).map(port => ({
name: port.Label,
port: port.Value,
to: port.To,
isDynamic: true,
}));
function isIP (string) {
if (isIpLib.v4(string)) return 4
else if (isIpLib.v6(string)) return 6
else return 0
}
normalize(typeHash, hash) {
const ip = hash.IP;
if (isIp.v6(ip)) {
hash.IP = `[${ip}]`;
}
return this._super(...arguments);
},
});