Add IPv6 detection

This adds support for sending UDP stats over IPv6.

Also, when DNS caching is enabled, if a previously configured IPv4 host is detected as IPv6 (or vice-versa), it closes the UDP socket and creates a new one.

Still missing some tests..