src/transport.js
function ourAddresses (peerInfo) {
  const ourPeerId = peerInfo.id.toB58String()
  return peerInfo.multiaddrs.toArray()
    .reduce((ourAddrs, addr) => {
      const peerId = addr.getPeerId()
      addr = addr.toString()
      const otherAddr = peerId
        ? addr.slice(0, addr.lastIndexOf(`/ipfs/${peerId}`))
        : `${addr}/ipfs/${ourPeerId}`
      return ourAddrs.concat([addr, otherAddr])
    }, [])
    .filter(a => Boolean(a))
    .concat(`/ipfs/${ourPeerId}`)
}
function ourAddresses (peerInfo) {
  const ourPeerId = peerInfo.id.toB58String()
  return peerInfo.multiaddrs.toArray()
    .reduce((ourAddrs, addr) => {
      const peerId = addr.getPeerId()
      addr = addr.toString()
      const otherAddr = peerId
        ? addr.slice(0, addr.lastIndexOf(`/ipfs/${peerId}`))
        : `${addr}/ipfs/${ourPeerId}`
      return ourAddrs.concat([addr, otherAddr])
    }, [])
    .filter(a => Boolean(a))
    .concat(`/ipfs/${ourPeerId}`)
}
function ourAddresses ( peerInfo ) { const ourPeerId = peerInfo . id . toB58String ( ) return peerInfo . multiaddrs . toArray ( ) . reduce ( ( ourAddrs , addr ) => { const peerId = addr . getPeerId ( ) addr = addr . toString ( ) const otherAddr = peerId ? addr . slice ( 0 , addr . lastIndexOf ( ` ${ peerId } ` ) ) : ` ${ addr } ${ ourPeerId } ` return ourAddrs . concat ( [ addr , otherAddr ] ) } , [ ] ) . filter ( a => Boolean ( a ) ) . concat ( ` ${ ourPeerId } ` ) }
Expand addresses in peer info into array of addresses with and without peer
ID suffix.

@param {PeerInfo} peerInfo Our peer info object
@returns {String[]}
Expand addresses in peer info into array of addresses with and without peer ID suffix .