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.
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.