[GH-ISSUE #359] [BUG] Proxyman sometimes can't detect the IPv4 from PC. It shows a default value 127.0.0.1 #360

Open
opened 2026-03-03 19:50:07 +03:00 by kerem · 1 comment
Owner

Originally created by @NghiaTranUIT on GitHub (Jan 28, 2024).
Original GitHub issue: https://github.com/ProxymanApp/proxyman-windows-linux/issues/359

Originally assigned to: @kics223w1 on GitHub.

Description

There are at least 2 users, who reported this bug.

It shows 127.0.0.1 (default value) in the Android Setup, and the status bar.

Screenshot 2024-01-28 at 09 06 28

Steps to Reproduce

  1. Not sure hot to reproduce it, but it's failed to get the current IPv4

Current Behavior

  • Can't get the current IPv4

Expected Behavior

  • Double check the func, to see why Proxyman can't fetch any IPv4
  • Find a better npm package (high download, reliable, ... ) (maybe we can fall back to current library if the new one doesn't work) -> Find in this docs: https://www.electronjs.org/docs/latest/api/session to see if we have any native API to get the IPv4
Originally created by @NghiaTranUIT on GitHub (Jan 28, 2024). Original GitHub issue: https://github.com/ProxymanApp/proxyman-windows-linux/issues/359 Originally assigned to: @kics223w1 on GitHub. ## Description There are at least 2 users, who reported this bug. It shows `127.0.0.1` (default value) in the Android Setup, and the status bar. <img width="671" alt="Screenshot 2024-01-28 at 09 06 28" src="https://github.com/ProxymanApp/proxyman-windows-linux/assets/5878421/e9900fb0-edf8-4a0e-a202-50491ef515a0"> ## Steps to Reproduce 1. Not sure hot to reproduce it, but it's failed to get the current IPv4 ## Current Behavior - Can't get the current IPv4 ## Expected Behavior - [ ] Double check the func, to see why Proxyman can't fetch any IPv4 - [ ] Find a better npm package (high download, reliable, ... ) (maybe we can fall back to current library if the new one doesn't work) -> Find in this docs: https://www.electronjs.org/docs/latest/api/session to see if we have any native API to get the IPv4
Author
Owner

@NghiaTranUIT commented on GitHub (Jan 28, 2024):

Maybe we can leverage the os from NodeJS.

const os = require('os');

function getIPv4Address() {
    const networkInterfaces = os.networkInterfaces();
    for (const interfaceDetail of Object.values(networkInterfaces)) {
        // `interfaceDetail` might be undefined if no network is attached to the interface
        if (!interfaceDetail) {
            continue;
        }
        
        for (const detail of interfaceDetail) {
            // Look for an IPv4 address that is not an internal (localhost) address
            if (detail.family === 'IPv4' && !detail.internal) {
                return detail.address;
            }
        }
    }

    // Return undefined or a fallback address if no external IPv4 address was found
    return '127.0.0.1';
}

console.log(getIPv4Address());

<!-- gh-comment-id:1913414866 --> @NghiaTranUIT commented on GitHub (Jan 28, 2024): Maybe we can leverage the `os` from NodeJS. ``` const os = require('os'); function getIPv4Address() { const networkInterfaces = os.networkInterfaces(); for (const interfaceDetail of Object.values(networkInterfaces)) { // `interfaceDetail` might be undefined if no network is attached to the interface if (!interfaceDetail) { continue; } for (const detail of interfaceDetail) { // Look for an IPv4 address that is not an internal (localhost) address if (detail.family === 'IPv4' && !detail.internal) { return detail.address; } } } // Return undefined or a fallback address if no external IPv4 address was found return '127.0.0.1'; } console.log(getIPv4Address()); ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxyman-windows-linux#360
No description provided.