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 | 541d1444efc4150ad3e644c7c262f51a4a26c0bb (patch) | |
| tree | 6217da847a2e2fb0750979f45118586a41043a07 /src/transport/libp2p/routes.rs | |
| parent | 5728ce9ef83f933291d900be262fc4369f988233 (diff) | |
libp2p: no public addresses before probes
Diffstat (limited to 'src/transport/libp2p/routes.rs')
| -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() } |
