You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(a) request a dial of a specific peer by their PeerId via NetworkBehaviourAction::DialPeer, where the concrete addresses to be dialed are collected via NetworkBehaviour::addresses_of_peer
or (b) request a dial of a single specific address via NetworkBehaviourAction::DialAddress
Problem
A NetworkBehaviour implementation might want to choose the specific fixed set of addresses to be dialed for a given peer. This is the case in #2076 where the remote provides a specific set of addresses to be dialed by the local node.
Using NetworkBehaviourAction::DialPeer and providing the set of addresses via NetworkBehaviour::addresses_of_peer does not prevent other NetworkBehaviour implementations to add bogus addresses to the set via NetworkBehaviour::addresses_of_peer.
Proposal
Merge NetworkBehaviourAction::DialPeer and NetworkBehaviourAction::DialAddress into a single NetworkBehaviourAction::Dial.
In NetworkBehaviourAction::Dial allow specifying either:
A PeerId only, where the Swarm retrieves corresponding addresses via NetworkBehaviour::addresses_of_peer.
A PeerId and a set of addresses
with the option of the Swarm extending the set of addresses via NetworkBehaviour::addresses_of_peer.
A set of addresses.
Miscellaneous
Next to enabling a NetworkBehaviour implementation to specify a specific fixed set of addresses to be dialed, the change above would simplify other implementations. E.g. in the case where a NetworkBehaviour implementation wants to dial a peer by its PeerId, also providing some addresses, it can provide these addresses right away within NetworkBehaviourAction::Dial, instead of first emitting a NetworkBehaviourAction::DialPeer and then providing the set of addresses via NetworkBehaviour::addresses_of_peer.
Status Quo
One can either
(a) request a dial of a specific peer by their
PeerIdviaNetworkBehaviourAction::DialPeer, where the concrete addresses to be dialed are collected viaNetworkBehaviour::addresses_of_peeror (b) request a dial of a single specific address via
NetworkBehaviourAction::DialAddressProblem
A
NetworkBehaviourimplementation might want to choose the specific fixed set of addresses to be dialed for a given peer. This is the case in #2076 where the remote provides a specific set of addresses to be dialed by the local node.Using
NetworkBehaviourAction::DialPeerand providing the set of addresses viaNetworkBehaviour::addresses_of_peerdoes not prevent otherNetworkBehaviourimplementations to add bogus addresses to the set viaNetworkBehaviour::addresses_of_peer.Proposal
NetworkBehaviourAction::DialPeerandNetworkBehaviourAction::DialAddressinto a singleNetworkBehaviourAction::Dial.NetworkBehaviourAction::Dialallow specifying either:PeerIdonly, where theSwarmretrieves corresponding addresses viaNetworkBehaviour::addresses_of_peer.PeerIdand a set of addressesSwarmextending the set of addresses viaNetworkBehaviour::addresses_of_peer.Miscellaneous
Next to enabling a
NetworkBehaviourimplementation to specify a specific fixed set of addresses to be dialed, the change above would simplify other implementations. E.g. in the case where aNetworkBehaviourimplementation wants to dial a peer by itsPeerId, also providing some addresses, it can provide these addresses right away withinNetworkBehaviourAction::Dial, instead of first emitting aNetworkBehaviourAction::DialPeerand then providing the set of addresses viaNetworkBehaviour::addresses_of_peer.To reduce conflicts I would suggest tackling this after core/: Concurrent connection attempts #2248 is merged.