Merge pull request #119 from rogerdz/fix-announced-ip

fix announcedIp in network mode host
هذا الالتزام موجود في:
Miroslav Pejic
2023-08-26 11:35:04 +02:00
ملتزم من قبل GitHub
الأصل f67a1dc763 3c6302347a
التزام 26fc83b9c8

عرض الملف

@@ -5,14 +5,16 @@ const ifaces = os.networkInterfaces();
const getLocalIp = () => {
let localIp = '127.0.0.1';
let checkIp = true;
Object.keys(ifaces).forEach((ifname) => {
for (const iface of ifaces[ifname]) {
// Ignore IPv6 and 127.0.0.1
if (iface.family !== 'IPv4' || iface.internal !== false) {
if (iface.family !== 'IPv4' || iface.internal !== false || checkIp === false) {
continue;
}
// Set the local ip to the first IPv4 address found and exit the loop
localIp = iface.address;
checkIp = false
return;
}
});