fix announcedIp in network mode host

هذا الالتزام موجود في:
Hieu Dang
2023-08-09 23:49:57 +07:00
الأصل 795053cde2
التزام 3c6302347a

عرض الملف

@@ -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;
}
});