From 541d1444efc4150ad3e644c7c262f51a4a26c0bb Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 1 Nov 2026 19:57:16 +0100 Subject: libp2p: no public addresses before probes --- src/transport/libp2p/routes.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') 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, /// 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) -> Self { + let unknown = !internet_hosts.is_empty(); Self { + internet: [!unknown, !unknown], internet_hosts, ..Self::default() } -- cgit v1.3.1