标签:this span mil work node.js obj nod ddr ace
; (function (win) { var os = require(‘os‘); var ifaces = os.networkInterfaces(); function NetworkUtil() { var _self = this; this.getMac = function(family){ var mac = ‘‘; Object.keys(ifaces).forEach(function (ifname) { ifaces[ifname].forEach(function (iface) { if (family !== iface.family || iface.internal !== false) { return; } mac = iface.mac; }); }); return mac; } this.getIP = function(family){ var ip = ‘‘; Object.keys(ifaces).forEach(function (ifname) { ifaces[ifname].forEach(function (iface) { if (family !== iface.family || iface.internal !== false) { return; } ip = iface.address; }); }); return ip; } } win.global_NetworkUtil = new NetworkUtil(); })(window);
标签:this span mil work node.js obj nod ddr ace
原文地址:https://www.cnblogs.com/ytxiao/p/9070568.html