Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add js-libp2p-switch to the libp2p codebase #388

Merged
merged 697 commits into from
Aug 8, 2019

Conversation

jacobheun
Copy link
Contributor

@jacobheun jacobheun commented Jul 29, 2019

This PR adds js-libp2p-switch to js-libp2p as a part of #384.

Things to note:

  • The entire libp2p-switch history has been added
  • Additional commits were made to move switch under ./src/switch and its tests under ./test/switch.
  • Some of the unneeded files were removed (like LICENSE) since libp2p already has a version of that file
  • The readme and package.json from switch were kept, to simplify the transition. Ideally this should all get cleaned up and duplicate tests should be removed in a future PR

Note on Merging: Follow steps mentioned at #388 (comment).

jacobheun and others added 21 commits July 31, 2019 18:47
* docs: update browser example pubsub

* docs: fix pubsub example config

* fix: make pubsub default to enabled

This allows for only adding the module to have it enabled. Previously you would have to supply and enable the module which is unncessary for users
"denylist" more adequately describes what this list is for.

BREAKING CHANGE: Constructor options `blacklistTTL` and `blackListAttempts` have been renamed to `denyTTL` and `denyAttempts`. The error code from errors thrown when dial is currently denied has changed from `ERR_BLACKLISTED` to `ERR_DENIED`.

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
* chore: update deps and fix lint

* test: fix tests after webrtc-star upgrade
* fix: dont override methods of created instance

* chore: fix lint
BREAKING CHANGE: switch configuration has changed.
'blacklistTTL' is now 'denyTTL' and 'blackListAttempts' is now 'denyAttempts'
* chore: update ws rendezvous dep

test(fix): fix tests with latest ws rendezvous server

* fix: promisification of libp2p methods

test: add tests to verify promisify support until async/await endeavor is complete

* chore: fix linting
@jacobheun jacobheun marked this pull request as ready for review August 8, 2019 14:38
@jacobheun
Copy link
Contributor Author

@vasco-santos there are some flakey tests on windows atm. My plan is to get the rest of the core modules in first and then fix all of those and dedupe some of the tests as well. For each PR I'm mainly focused on getting the Travis builds passing. I think if we end up fixing tests fully for each merge it's going to chew up a lot of time unnecessarily.

Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! 🚀 I just left 3 minor things to consider

Also, we can’t forget about tracking the issues and open PRs on js-libp2p-switch. Regarding the issues, we should probably make a pass through them and move the relevant ones. On PRs, we should probably comment an update that the repo content was moved.

[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io)
[![Travis CI](https://flat.badgen.net/travis/libp2p/js-libp2p-switch)](https://travis-ci.com/libp2p/js-libp2p-switch)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove CI, cdecov and dependency status?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I will go through and sweep the READMEs and cleanup the package.json files as part of the next PR to pull everything else in. If we keep the package.json files it may just be a super stripped down version, as the main reason I left them in is to be able to keep the clean libp2p-switch require statements. But that might be unnecessary once everything is cleaned up.

* @throws {InvalidPeerType}
* @returns {PeerInfo}
*/
function getPeerInfo (peer, peerBook) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably make sense in other contexts. So, after getting all other modules in here, we should also analyze all the utils and put them in a common util folder

},
"repository": {
"type": "git",
"url": "https://github.com/libp2p/js-libp2p-switch.git"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about these URLs? Should we remove them? At least the bugs one should point to this repo

@jacobheun jacobheun merged commit fd738f9 into libp2p:master Aug 8, 2019
@jacobheun jacobheun deleted the refactor/switch branch August 8, 2019 17:01
@jacobheun jacobheun mentioned this pull request Aug 8, 2019
10 tasks
maschad pushed a commit to maschad/js-libp2p that referenced this pull request Jun 21, 2023
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
maschad pushed a commit to maschad/js-libp2p that referenced this pull request Jun 21, 2023
## [5.0.2](libp2p/js-libp2p-kad-dht@v5.0.1...v5.0.2) (2022-11-05)

### Dependencies

* bump it-all from 1.0.6 to 2.0.0 ([libp2p#389](libp2p/js-libp2p-kad-dht#389)) ([0596485](libp2p/js-libp2p-kad-dht@0596485))
* bump it-drain from 1.0.5 to 2.0.0 ([libp2p#390](libp2p/js-libp2p-kad-dht#390)) ([fdda357](libp2p/js-libp2p-kad-dht@fdda357))
* bump it-first from 1.0.7 to 2.0.0 ([libp2p#391](libp2p/js-libp2p-kad-dht#391)) ([681c24e](libp2p/js-libp2p-kad-dht@681c24e))
* bump it-length from 1.0.4 to 2.0.0 ([libp2p#394](libp2p/js-libp2p-kad-dht#394)) ([ae07736](libp2p/js-libp2p-kad-dht@ae07736))
* bump it-map from 1.0.6 to 2.0.0 ([libp2p#396](libp2p/js-libp2p-kad-dht#396)) ([ac5101c](libp2p/js-libp2p-kad-dht@ac5101c))
* bump it-merge from 1.0.4 to 2.0.0 ([libp2p#393](libp2p/js-libp2p-kad-dht#393)) ([1acb5f1](libp2p/js-libp2p-kad-dht@1acb5f1))
* bump it-parallel from 2.0.2 to 3.0.0 ([libp2p#392](libp2p/js-libp2p-kad-dht#392)) ([06a2c48](libp2p/js-libp2p-kad-dht@06a2c48))
* bump it-take from 1.0.2 to 2.0.0 ([libp2p#397](libp2p/js-libp2p-kad-dht#397)) ([4e909d2](libp2p/js-libp2p-kad-dht@4e909d2))
* **dev:** bump it-filter from 1.0.3 to 2.0.0 ([libp2p#395](libp2p/js-libp2p-kad-dht#395)) ([5668f9c](libp2p/js-libp2p-kad-dht@5668f9c))
* **dev:** bump it-last from 1.0.6 to 2.0.0 ([libp2p#388](libp2p/js-libp2p-kad-dht#388)) ([5b55239](libp2p/js-libp2p-kad-dht@5b55239))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.