prefer IPv4 to IPv6 during DNS resolution

freegeoip was failing on OSX because DNS was returning IPv6 address in addition to IPv4 address. This patch prefers the IPv4 if possible, and hence makes freegeoip work on OSX again.