pub fn probe() -> Option<CloudInfo>Expand description
AWS IMDSv2 (token + header) with IMDSv1 fallback. Returns None if not on EC2.
When the IMDSv2 token PUT succeeds, the token is valid – no extra validation GET
to META_ROOT (avoids an unnecessary timeout on non-AWS hosts). If the token
fetch fails, fall back to unauthenticated IMDSv1 GET on META_ROOT.
After reachability is confirmed the probe additionally verifies
/latest/meta-data/services/domain equals "amazonaws.com" so that other
cloud providers exposing an EC2-compatible metadata service are not mistaken
for AWS.