-
Notifications
You must be signed in to change notification settings - Fork 28
Conversation
Almost! :) Unfortunately (or fortunately, I still don't know if there is a valid reason), TCP and UDP ports are different and some kernels also offer SCTP, which I'm not 100% sure if they share the same port space as UDP, that being said, making it unique by port would filter out valid addresses. You also might want to use multiple network interfaces with the same port |
I added to the transport object in js-multiaddr so that I could filter on it here. If you have this: The filter will return this: |
Looking good! Can you also add tests? |
Yes, I will work on adding some tests. |
diasdavid: There are two test that are failing for the repo now which I don't believe has anything to do with what I have been working on. After looking at the 2 tests I don't see how the test would ever pass. The 2 test are:
Do you have any insight on this? |
@@ -2,6 +2,7 @@ | |||
|
|||
const Id = require('peer-id') | |||
const multiaddr = require('multiaddr') | |||
const _ = require('lodash') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use const uniqBy = require('lodash.uniqBy')
if that is the only feature you are going to use, it saves in bundle size :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
David, I have not seen a require like this: require('lodash.uniqBy'), did you mean like this: require('lodash').uniqBy? Or am I missing something?
CI looks fine to me, with the exception that SauceLabs is being wonky. where do you see those tests failing specifically @SidHarder ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method can be called from libp2p-swarm/lib/transport.js just before the createListeners method is called and may be a solution to issue ipfs/js-ipfs#228. This method returns an array of multiaddr which are distinct by port. Transport is not considered, if there are two transports with the same port the first multiaddr will be returned.
Question: