diff options
| author | tv <tv@krebsco.de> | 2026-11-01 19:57:16 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-01 19:57:16 +0100 |
| commit | 9ce725c5a2ded3f9b585568003c9e75c5934158a (patch) | |
| tree | 34a517762be012e667b9a3d8857a33173caed926 | |
| parent | f26904fdd167b31566fd79cbffcbfc4bafae0c28 (diff) | |
libp2p: no public addresses before probes
| -rw-r--r-- | src/transport/libp2p/routes.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/transport/libp2p/routes.rs b/src/transport/libp2p/routes.rs index 05e14e8..3108f0c 100644 --- a/src/transport/libp2p/routes.rs +++ b/src/transport/libp2p/routes.rs @@ -42,7 +42,9 @@ pub(super) struct Routes { known: HashMap<IpRange, (bool, tokio::time::Instant)>, /// Whether there is a route to the internet, per family (IPv4, IPv6), as last /// asked (`internet`): own public addresses are published only then. True where - /// nobody asks (no `--libp2p-internet-hosts` of that family). + /// nobody asks (no `--libp2p-internet-hosts` of that family); false until the first + /// answer where someone does (resolving takes up to `RESOLVE_WITHIN`), so the first + /// member list entry doesn't list addresses nobody can reach. internet: [bool; 2], /// `--libp2p-internet-hosts`: names or addresses on the internet, whose routes /// tell whether there is one to the internet at all. @@ -74,7 +76,9 @@ fn range_of(ip: IpAddr) -> IpRange { impl Routes { /// With `--libp2p-internet-hosts` `internet_hosts`. pub(super) fn asking(internet_hosts: Vec<String>) -> Self { + let unknown = !internet_hosts.is_empty(); Self { + internet: [!unknown, !unknown], internet_hosts, ..Self::default() } |
