metadata: try different strategies for detecting OnGCE
metadata: try different strategies for detecting OnGCE

In an attempt to make OnGCE faster and more accurate, race two
strategies: HTTP directly to the metadata IP address, and DNS of the
metadata hostname. And then increase the HTTP timeout too, since it
was only very low to not make OnGCE very low for people not on GCE.

Testing a modified version of this change on GCE, I ran it 100 times
in a row (resetting the sticky cached value) and it got the same
answer (true), but from a mix of sources: sometimes HTTP won, and
sometimes DNS won. So both strategies are working at least. But I've
never been able to reproduce the slowness and failing
results. Hopefully others will be able to report whether this helps.

Fixes GoogleCloudPlatform/gcloud-golang#194 hopefully.

Change-Id: Ic7360e8eb589c213eb56b0763d1c20cbd6fcd28e
Reviewed-on: https://code-review.googlesource.com/4361
Reviewed-by: Andrew Gerrand <395a7d33bec8475c9b83b7d440f141bcbd994aa5@google.com>

michael-grosshans/google-cloud-go,googleapis/google-cloud-go,googleapis/google-cloud-go,googleapis/google-cloud-go,michael-grosshans/google-cloud-go,googleapis/google-cloud-go