I am creating snmp session everything is working as expected , i will be getting dynamic value of host
to create session, I just want to put if condition to check Ip address is correct or not , is there way to validate IP address in javascript ?
main.js
var host = "135.01.01.01";
var sessionOptions = {
port: 161,
retries: 1,
timeout: 5000,
transport: "udp4",
trapPort: msg.event.body.trapPort,
version: snmpVersion
};
//Create snmp Session
var session = snmp.createSession(host, "public", sessionOptions);
try {
if (!host) {
console.log("Could not find host");
} else {
session.trap(trapOid, varbinds, options, function(error) {
if (error)
console.log(error);
else
console.log('SNMP successfully delivered');
});
}
} catch (e) {
console.log("SNMP processing error: " + e);
}