rust-ipfs icon indicating copy to clipboard operation
rust-ipfs copied to clipboard

Auto relay connection

Open dariusc93 opened this issue 2 years ago • 2 comments

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

  1. Build up a map to keep track of active peers with the relay protocol
  2. Determine the max number we can and should listen on ~~(eg does it do anything to listen on multiple relays as been done manually?).~~
  3. Only use relays when behind a nat or firewall, otherwise dont use relays unless connection is being blocked in some way.
  4. Track the ListenId after doing Swarm::listen_on and use it to remove the listener when there is an issue related to it

Draft 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?).

dariusc93 avatar Sep 13 '22 23:09 dariusc93