1
0
Fork 0
mirror of synced 2024-12-28 01:23:20 -05:00
ultimate-vim/sources_non_forked/markdown-preview.nvim/app/lib/util/getIP.js

22 lines
607 B
JavaScript
Raw Normal View History

2022-05-19 08:12:11 -04:00
"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;