* refactor: add dialing over relay support
* chore: fix lint
* fix: dont clear listeners on close
* fix: if dial errors already have codes, just rethrow them
* fix: clear the registrar when libp2p stops
* fix: improve connection maintenance with circuit
* chore: correct feedback
* test: use chai as promised
* test(fix): reset multiaddrs on dial test
* chore(deps): update connection and multistream
* feat: add basic dial support for addresses and peers
* test: automatically require all node test files
* fix: dont catch and log in the wrong place
* test: add direct spec test
fix: improve dial error consistency
* feat: add dial timeouts and concurrency
Queue timeouts will result in aborts of the dials
* chore: fix linting
* test: verify dialer defaults
* feat: add initial upgrader
* fix: add more test coverage and fix bugs
* feat: libp2p creates the upgrader
* feat: hook up handle to the upgrader
* feat: hook up the dialer to libp2p
test: add node dialer libp2p tests
* feat: add connection listeners to upgrader
* feat: emit connect and disconnect events
* chore: use libp2p-interfaces
* fix: address review feedback
* fix: correct import
* refactor: dedupe connection creation code
* test: remove all tests for a clean slate
The refactor will require a large number of updates to the tests. In order
to ensure we have done a decent deduplication, and have a cleaner suite of tests
we've removed all tests. This will also allow us to more easily see tests
for the refactored systems.
We have a record of the latest test suites in master, so we are not losing any history.
* chore: update tcp and websockets
* chore: remove other transports until they are converted
* chore: use mafmt and multiaddr async versions
* chore: add and fix dependencies
* chore: clean up travis file
* feat: add new transport manager
* docs: add constructor jsdocs
* refactor(config): check that transports exist
This also removes the other logic, it can be added when those subsystems are refactored
* chore(deps): use async peer-id and peer-info
* feat: wire up the transport manager with libp2p
* chore: remove superstruct dep
The get peer info util consolidation from #400 exposed an issue
with how bad values are being handled. Throwing the error can cause
issues when promises are being used. Rejecting resolves this.
I added a test case to validate the change.
This removes defaults from superstruct and instead uses
mergeOptions to deeply set the defaults on configuration.
This ensures that defaults are properly set.
This is a step toward removing superstruct altogether, #406,
but it is still being used for basic type validation.
* refactor: add js-libp2p-connection-manager to repo
Co-authored-by: David Dias <daviddias.p@gmail.com>
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
Co-authored-by: Pedro Teixeira <i@pgte.me>
Co-authored-by: Vasco Santos <vasco.santos@ua.pt>
* test(conn-mgr): only run in node
* refactor: add js-libp2p-identify to repo
Co-authored-by: David Dias <daviddias.p@gmail.com>
Co-authored-by: Friedel Ziegelmayer <dignifiedquire@gmail.com>
Co-authored-by: Hugo Dias <hugomrdias@gmail.com>
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
Co-authored-by: Maciej Krüger <mkg20001@gmail.com>
Co-authored-by: Richard Littauer <richard.littauer@gmail.com>
Co-authored-by: Vasco Santos <vasco.santos@moxy.studio>
Co-authored-by: Yusef Napora <yusef@protocol.ai>
Co-authored-by: ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>
* refactor: add libp2p-pnet to repo
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
Co-authored-by: Vasco Santos <vasco.santos@moxy.studio>
* refactor: add libp2p-ping to repo
Co-authored-by: David Dias <daviddias.p@gmail.com>
Co-authored-by: Francisco Baio Dias <xicombd@gmail.com>
Co-authored-by: Friedel Ziegelmayer <dignifiedquire@gmail.com>
Co-authored-by: Hugo Dias <mail@hugodias.me>
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
Co-authored-by: João Antunes <j.goncalo.antunes@gmail.com>
Co-authored-by: Richard Littauer <richard.littauer@gmail.com>
Co-authored-by: Vasco Santos <vasco.santos@moxy.studio>
Co-authored-by: Vasco Santos <vasco.santos@ua.pt>
Co-authored-by: ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>
* refactor: add libp2p-circuit to repo
Co-authored-by: David Dias <daviddias.p@gmail.com>
Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
Co-authored-by: Friedel Ziegelmayer <dignifiedquire@gmail.com>
Co-authored-by: Hugo Dias <mail@hugodias.me>
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
Co-authored-by: Maciej Krüger <mkg20001@gmail.com>
Co-authored-by: Oli Evans <oli@tableflip.io>
Co-authored-by: Pedro Teixeira <i@pgte.me>
Co-authored-by: Vasco Santos <vasco.santos@ua.pt>
Co-authored-by: Victor Bjelkholm <victorbjelkholm@gmail.com>
Co-authored-by: Yusef Napora <yusef@napora.org>
Co-authored-by: dirkmc <dirk@mccormick.cx>
* test(switch): avoid using instanceof
* chore(switch): update bignumber dep
* refactor(circuit): clean up tests
* refactor(switch): consolidate get peer utils
* test(identify): do deep checks of addresses
* test(identify): bump timeout for identify test
* test(switch): tidy up limit dialer test
* refactor(switch): remove redundant circuit tests
* chore: add coverage script
* refactor(circuit): consolidate get peer info
* docs: reference original repositories in each sub readme
* docs: fix comment
* refactor: clean up sub package.json files and readmes
* 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
* 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
BREAKING CHANGE: new configuration for deciding the implementation of pubsub to be used.
In this context, the experimental flags were also removed. See the README for the latest usage.
* feat: promisify all api methods that accept callbacks
This is a stop-gap until the full async/await migration can be
completed. It means we can refactor tests of other modules that
depend on this module without having to mix async flow control
strategies.
N.b. some methods that were previously callable without callbacks
(e.g. `node.start()`, `node.stop()`, etc) now require callbacks
otherwise a promise is returned which, if rejected, can cause
`unhandledPromiseRejection` events and lead to memory leaks.
* docs: add a global note to the api about promisify
* fix: update the logic for unsubscribe
* test(fix): correct pubsub unsubscribe usage for api change
* test(fix): update content routing tests for latest delegate version
createLibp2p is a new exported helper function that allows users to create a libp2p instance without worrying about creating a PeerInfo instance first.