Do DNS lookups and select a random host.

This fixes a regression entered during the C -> Go port where the dns
randomizer feature was lost.