libp2p / js-peer-info

libp2p Peer abstraction Node.js implementation
https://libp2p.io
MIT License
37 stars 28 forks source link

fix: distinct should work for non port addresses #78

Closed jacobheun closed 5 years ago

jacobheun commented 5 years ago

This fixes an issue with .distinct() being called when the addresses do not have ports. It's entirely valid to have an address that doesn't have a port, so we should just treat the entirety of those addresses as unique.

Note, as mentioned in comments in distinct this logic doesn't really belong in PeerInfo. When we implement https://github.com/libp2p/interface-transport/issues/41 for transports, it should handle distinct addresses when listening. This is a stop gap until that is complete.

required by https://github.com/ipfs/interop/issues/63

jacobheun commented 5 years ago

Closing this in favor of https://github.com/libp2p/js-libp2p-switch/pull/334