What is difference between /ipfs and /p2p protocol?

In the multiaddr, two protocols ipfs or p2p can be used, e.g., /ip4/127.0.0.1/tcp/1000/ipfs/ or /ip4/127.0.0.1/tcp/1000/p2p. What is the difference between them?

/ipfs and /p2p are aliases of the string representation of the multiaddr codec (421). On the network they are exactly the same. /ipfs is a legacy name, it is being change to /p2p by default as this name better reflects the intended usage of Peer Ids in any peer to peer system, not just IPFS.

In short, there is no difference, but old go/js nodes may not recognize p2p if you attempt to dial via the stringified address on a local node. Nodes receiving the address over the network aren’t affected.

Thanks for this quick response. It is very helpful