kopia lustrzana https://github.com/inkstitch/inkstitch
18 wiersze
414 B
JavaScript
18 wiersze
414 B
JavaScript
'use strict'
|
|
|
|
const os = require('os')
|
|
|
|
module.exports = function getLocalIP() {
|
|
const interfaces = os.networkInterfaces()
|
|
|
|
for (const devName in interfaces) {
|
|
const iface = interfaces[devName]
|
|
for (let i = 0; i < iface.length; i++) {
|
|
const alias = iface[i]
|
|
if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
|
|
return alias.address
|
|
}
|
|
}
|
|
}
|
|
}
|