Ipfs p2p command



I am trying to use P2P command to connect to a peer. The question is, does the peer has to be already connected to current node? or it can be any peer with correct multi-address ?

And a similar question with “ipfs swarm connect” command. Does the peer to connect has to be already among “ipfs swarm peers”, or it can be any valid multi-address ?




ipfs swarm peers lists currently connected peers, so it’s definitely not limited to peers you’re already connected to. The node just needs to be reachable.

I’m not sure about your first question related to ipfs p2p. I’d have to test it to be sure.