network: Only insert global addresses into the DHT. (#5735)
* network: Only insert global addresses into the DHT. Currently every address reported via libp2p-identify is inserted into the DHT which thus contains a multitude of unreachable addresses such as from 127.0.0.0/8 or 10.0.0.0/8. Issue #5099 suggested a dedicated service over UDP to gauge the reachability of an address, which would however incur extra I/O costs and be of limited use. As an alternative and simpler tactic, this PR only allows global IP addresses to be inserted into the DHT unless an explicit command-line flag `--allow-non-global-addresses-in-dht` is given or a node is started with `--dev`. This opt-in behaviour is meant to allow site-local networks to still make use of a DHT. * Enable non-global in more test setups. * Replace command-line option with different name. * Another test fix.
Showing
- substrate/Cargo.lock 7 additions, 0 deletionssubstrate/Cargo.lock
- substrate/client/cli/src/params/network_params.rs 7 additions, 0 deletionssubstrate/client/cli/src/params/network_params.rs
- substrate/client/network/Cargo.toml 7 additions, 6 deletionssubstrate/client/network/Cargo.toml
- substrate/client/network/src/config.rs 5 additions, 0 deletionssubstrate/client/network/src/config.rs
- substrate/client/network/src/discovery.rs 36 additions, 2 deletionssubstrate/client/network/src/discovery.rs
- substrate/client/network/src/service.rs 1 addition, 0 deletionssubstrate/client/network/src/service.rs
- substrate/client/network/test/src/lib.rs 2 additions, 0 deletionssubstrate/client/network/test/src/lib.rs
- substrate/client/service/test/src/lib.rs 2 additions, 0 deletionssubstrate/client/service/test/src/lib.rs
Please register or sign in to comment