1
0
Fork 0
mirror of synced 2024-12-27 17:13:21 -05:00
ultimate-vim/sources_non_forked/markdown-preview.nvim/app/lib/util/getIP.js
2022-05-19 20:12:11 +08:00

21 lines
607 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getIP = void 0;
function getIP() {
const interfaces = require('os').networkInterfaces();
let IP = '';
Object.keys(interfaces).some(devName => {
const iface = interfaces[devName];
for (const alias of iface) {
if (alias.family === 'IPv4' &&
alias.address !== '127.0.0.1' &&
!alias.internal) {
IP = alias.address;
return true;
}
}
return false;
});
return IP;
}
exports.getIP = getIP;