net: Allow custom DNS resolvers

net.connect now checks whether the user has provided a dns
resolution function, this arguments and expected output
for which mirror the existing dns.lookup implementation.

Fixes #8475
Maybe just pass the arguments to the real `dns.lookup()` to avoid hard coding IPv4 data here.