Open dariusc93 opened 2 years ago
This will be done inside of a behaviour which would allow static relays (one users can add themselves) as well as an option to add relays while walking DHT.
Overall:
Add relay (peer and their multihash) to a map as pending and initiate a connection to their multiaddr.
Monitor relays and measure their avg ping. Any relays that have an extremely high avg ping for a long duration, timeout or disconnect will be removed from the candidate list
Update identify on each change (may require push in identify to be enabled so this is done automatically unless there is a way to do that through the behaviour)
Static Relays:
Dynamic (or auto) Relays:
Questions:
Reference: https://github.com/libp2p/rust-libp2p/discussions/2944 https://github.com/libp2p/go-libp2p/blob/031ec50a04507cb2def993ef0ad15cf95eb98922/p2p/host/autorelay/options.go#L37-L45 (Thanks mxinden) https://github.com/libp2p/go-libp2p/blob/031ec50a04507cb2def993ef0ad15cf95eb98922/p2p/host/autorelay/relay_finder.go#L71-L73
autorelay was moved to https://github.com/dariusc93/libp2p-autorelay though will leave this issue open for the time being since there is still more to do.
Should add a option to add listen on a relay automatically while behind a NAT. This would allow us to walk through DHT and find any peers that has the relay v2 protocol in which case we would then listen to it automatically. There are a couple of things that might need to be done
(eg does it do anything to listen on multiple relays as been done manually?).ListenId
after doingSwarm::listen_on
and use it to remove the listener when there is an issue related to itDraft should be first implemented into this crate and once its figured out to split it out into its own crate (or implement directly into libp2p?).