Make hostname optional

Don't want to pass this if we're doing a SRV lookup.
Support basic SRV lookup

Backporting this so we don't have to do the hostname lookup manually
everywhere.
Use SRV information where possible