n8n-nodes-my-local-ip
Version:
My Local Ip
23 lines • 953 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.IfConfigUtils = void 0;
class IfConfigUtils {
parseIfConfigIpv4(output) {
let results = [];
const lines = output.split('\n').filter((line) => line.trim() !== '');
for (const line of lines) {
let newInterface = {};
const regex = /^\s*inet\s*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s*netmask\s*((?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(?:0x[a-fA-F0-9]+))\s*broadcast\s*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/;
const match = line.match(regex);
if (match !== null) {
newInterface['ipv4'] = match[1];
newInterface['netmask'] = match[2];
newInterface['broadcast'] = match[3];
results.push(newInterface);
}
}
return results;
}
}
exports.IfConfigUtils = IfConfigUtils;
//# sourceMappingURL=IfConfigUtils.js.map