The internal/local IP lookup is done in-process, i.e., it does not call
system() or the like.
For an external address, the function returns a lookup from one of several
services, including
Amazon AWS http://checkip.amazonaws.com/,
httpbin http://httpbin.org/ip,
ipify https://www.ipify.org/,
and "My External IP address is ..." http://myexternalip.com/.
You must be connected to the internet for this to work. Please note that
pathological use could end up in your getting banned from these services,
rendering the function useless. So don't call this function a billion times
in a loop or something.