UNPKG

n8n-nodes-my-local-ip

Version:
23 lines 953 B
"use strict"; 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