1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! `online` owns reachability probing with zero dependencies.
//!
//! [`probe`] tests one socket address; [`is_online`] tests the public
//! internet via anycast endpoints. Both return plain booleans — a failed
//! probe is a signal, not an error.
//!
//! [`is_online`] exercises the live internet and is not covered by the
//! hermetic test suite; pin your own endpoint with [`probe`] instead.
use ;
use Duration;
// ── Probing ─────────────────────────────────────────────────────────────────
/// True when any address behind `addr` accepts TCP within `timeout`.
///
/// DNS failures, refused connections, and timeouts all report false.
/// True when the public internet is reachable within `timeout`.
///
/// Dials anycast endpoints over TCP (1.1.1.1:443, 8.8.8.8:53); true when
/// either answers. This is a heuristic for UI gating and diagnostics, not
/// a guarantee a given host is reachable — use [`probe`] for that.
// ── Tests ───────────────────────────────────────────────────────────────────