Add support of IPv6 in the hostname validation

I added an IPv6 regular expression in the regular expression used to check the hostname in /lib/validate.js.

Currently, the regex only support IPv4 and "litteral" hostnames.

This PR could be part of the issue #2160 (derivated from #1981) submited by @fmarier.