Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The myIpAddress() function returns an unexpected IP address #122

Closed
samuong opened this issue May 27, 2024 · 1 comment · Fixed by #123
Closed

The myIpAddress() function returns an unexpected IP address #122

samuong opened this issue May 27, 2024 · 1 comment · Fixed by #123

Comments

@samuong
Copy link
Owner

samuong commented May 27, 2024

The current implementation of myIpAddress() iterates over the list of interface addresses from net.InterfaceAddrs(), skipping over any IPv6 addresses, and IPv4 loopback addresses. Otherwise it returns the first IP address that it finds.

For example, a laptop's WiFi adapter might have an IP address of 192.168.1.2, but when connected to my corporate VPN, it will also have a network interface with the address 10.1.2.3. In many cases, Alpaca's implementation of myIpAddress() will pick the first address, which is not the internet-bound address, and not what many PAC scripts expect.

Alpaca is also inconsistent with the approaches taken by other implementations like Chrome and Firefox. We should align on either of these approaches, or at least do something similar.

@ziyiwang
Copy link

yup, confirmes this is working as expected on ourside, its now picking up the internet bound IP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants