Closed SidHarder closed 7 years ago
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: "Addresses": { "Swarm": [ "/ip4/0.0.0.0/tcp/4001", "/ip6/::/tcp/4001", "/ip4/0.0.0.0/udp/4001", "/ip6/::/udp/4001" ], "API": "/ip4/127.0.0.1/tcp/5001", "Gateway": "/ip4/127.0.0.1/tcp/8080" },
The filter will return this: "/ip4/0.0.0.0/tcp/4001" "/ip4/0.0.0.0/udp/4001"
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:
1) add multiaddr that are buffers 2) peer-info add multiaddr that are buffers:
Do you have any insight on this?
CI looks fine to me, with the exception that SauceLabs is being wonky. where do you see those tests failing specifically @SidHarder ?
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 https://github.com/ipfs/js-ipfs/issues/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: