124 Commits

Author SHA1 Message Date
Vasco Santos
f1eb373235 feat: discovery modules from transports should be added (#510)
* feat: discovery modules from transports should be added

* chore: apply suggestions from code review

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>

* chore: address review

* chore: apply suggestions from code review

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>
2020-01-24 14:40:40 +01:00
Jacob Heun
dabee00127 refactor: stats (#501)
* docs: add initial notes on stats

* feat: initial refactor of stats to metrics

* feat: add support for placeholder metrics

This is helpful for tracking metrics prior to knowing the remote peers id

* fix: add metrics tests and fix issues

* fix: always clear the dial timeout timer

* docs: add metrics to api doc

* chore: apply suggestions from code review

Co-Authored-By: Vasco Santos <vasco.santos@moxy.studio>

* docs: update metrics docs

* fix: call metrics.onDisconnect

* docs(config): add example headers so they appear in the TOC

* docs(config): add metrics configuration

* docs(relay): fix relay configuration docs
2020-01-24 14:40:40 +01:00
Vasco Santos
4f7586886c refactor: ping (#505)
* refactor: ping

* chore: ping is now a function

* chore: address review
2020-01-24 14:40:40 +01:00
Jacob Heun
90ecc57dbc fix: token release logic 2020-01-24 14:40:40 +01:00
Jacob Heun
ae52d483fc test: bump delay for ci 2020-01-24 14:40:40 +01:00
Jacob Heun
2570a1ba30 fix: release tokens as soon as they are available 2020-01-24 14:40:40 +01:00
Jacob Heun
633b0c291f fix: clean up pending dials abort per feedback 2020-01-24 14:40:40 +01:00
Jacob Heun
1df52ae205 test: remove timeout 2020-01-24 14:40:40 +01:00
Jacob Heun
ba02764c5f feat: abort all pending dials on stop 2020-01-24 14:40:40 +01:00
Jacob Heun
404fa69513 test: reduce randomwalk timeout 2020-01-24 14:40:40 +01:00
Jacob Heun
85988cfaab chore: fix lint
test: reduce interval of randomwalk in test

chore(test): glob fix
2020-01-24 14:40:40 +01:00
Jacob Heun
def3574ba0 test: add tests for DialRequest 2020-01-24 14:40:40 +01:00
Jacob Heun
6b1da8326f test(fix): fix support for it.only, it.skip, etc 2020-01-24 14:40:40 +01:00
Jacob Heun
466b4dfd70 chore: update per feedback 2020-01-24 14:40:40 +01:00
Jacob Heun
6ad840c3f3 chore: update docs
fix: protect against duplicate token releases
2020-01-24 14:40:40 +01:00
Jacob Heun
b86ef64904 refactor: consolidation multiaddr dial methods 2020-01-24 14:40:40 +01:00
Jacob Heun
b6cd48b798 refactor: clean up dial timeout abort 2020-01-24 14:40:40 +01:00
Jacob Heun
e1e3be8106 refactor: simplify DialRequest logic per feedback 2020-01-24 14:40:40 +01:00
Jacob Heun
e445a17278 feat: add token based dialer 2020-01-24 14:40:40 +01:00
Jacob Heun
12fc069873 fix: clean up peer discovery flow (#494)
* fix: clean up peer discovery flow

* test(fix): let libp2p start after connecting

* test(fix): dont auto dial in disco tests
2020-01-24 14:40:40 +01:00
Vasco Santos
9a6e07d70b chore: update pubsub implementations (#493) 2020-01-24 14:40:40 +01:00
Vasco Santos
8da9fc97d4 feat: support peer-id instances in peer store operations (#491) 2020-01-24 14:40:40 +01:00
Vasco Santos
a020db183a refactor: async routing (#489)
* feat: async routing

* chore: put dht extra api commands under content routing

* chore: add default option to createPeerInfo

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>

* chore: address review

* chore: rm dlv
2020-01-24 14:40:40 +01:00
Jacob Heun
f77ce39484 refactor: circuit relay to async (#477)
* 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
2020-01-24 14:40:40 +01:00
Vasco Santos
18a062ed12 feat: discovery modules (#486)
* feat: discovery modules

* chore: address review
2020-01-24 14:40:40 +01:00
dirkmc
1999606ecc fix: replace peerInfo addresses with listen addresses (#485)
* feat: replace peer info addresses with listen addresses

* test: add listening test

* chore: fix linting
2020-01-24 14:40:40 +01:00
Vasco Santos
c563e06a60 refactor: dht async/await (#480)
* refactor: core async (#478)

* refactor: cleanup core

test: auto dial on startup

* fix: make hangup work properly

* chore: fix lint

* chore: apply suggestions from code review

Co-Authored-By: Vasco Santos <vasco.santos@moxy.studio>

* fix: provide libp2p dialer to the dht

* chore: use dht release
2020-01-24 14:40:40 +01:00
Jacob Heun
f28b09fc0d refactor: update secio and tests to use it (#484)
* refactor: use async secio

* test: add secio to most test suites

* chore: update secio version
2020-01-24 14:40:40 +01:00
Jacob Heun
2104578924 refactor: core async (#478)
* refactor: cleanup core

test: auto dial on startup

* fix: make hangup work properly

* chore: fix lint

* chore: apply suggestions from code review

Co-Authored-By: Vasco Santos <vasco.santos@moxy.studio>
2020-01-24 14:40:40 +01:00
Vasco Santos
432b0997ae refactor: pubsub (#467)
* feat: peer-store v0

* chore: apply suggestions from code review

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>

* chore: address review

* refactor: pubsub subsystem

* chore: address review

* chore: use topology interface

* chore: address review

* chore: address review

* chore: simplify tests
2020-01-24 14:40:40 +01:00
Jacob Heun
c7a54f34f7 refactor: async identify and identify push (#473)
* chore: add missing dep

* feat: import from identify push branch

https://github.com/libp2p/js-libp2p-identify/tree/feat/identify-push

* feat: add the connection to stream handlers

* refactor: identify to async/await

* chore: fix lint

* test: add identify tests

* refactor: add identify to the dialer flow

* feat: connect identify to the registrar

* fix: resolve review feedback

* fix: perform identify push when our protocols change
2020-01-24 14:40:40 +01:00
Vasco Santos
9d52b80c45 feat: registrar (#471)
* feat: peer-store v0

* feat: registrar

* chore: apply suggestions from code review

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>

* chore: address review

* chore: support multiple conns

* chore: address review

* fix: no remote peer from topology on disconnect
2020-01-24 14:40:40 +01:00
Vasco Santos
582094a834 feat: peer store (#470)
* feat: peer-store v0

* chore: apply suggestions from code review

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>
2020-01-24 14:40:40 +01:00
Jacob Heun
fe2a8eddbb refactor: crypto and pnet (#469)
* feat: add initial plaintext 2 module

* refactor: initial refactor of pnet

* chore: fix lint

* fix: update plaintext api usage

* test: use plaintext for test crypto

* chore: update deps

test: update dialer suite scope

* feat: add connection protection to the upgrader

* refactor: cleanup and lint fix

* chore: remove unncessary transforms

* chore: temporarily disable bundlesize

* chore: add missing dep

* fix: use it-handshake to prevent overreading

* chore(fix): PR feedback updates

* chore: apply suggestions from code review

Co-Authored-By: Vasco Santos <vasco.santos@moxy.studio>
2020-01-24 14:40:40 +01:00
Jacob Heun
5e1dbc21a2 refactor(async): add dialer and upgrader (#462)
* 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
2020-01-24 14:40:40 +01:00
Jacob Heun
440fbf0c04 refactor(async): update transports subsystem (#461)
* 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
2020-01-24 14:40:40 +01:00
Alex Potsides
ae6af20e8e fix: pubsub promisify (#456)
* fix: allow pubsub sub/unsub via promises

* chore: fix linting errors
2019-09-24 14:02:07 +02:00
Jacob Heun
60b0cbc179
fix: reject rather than throw in get peer info (#410)
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.
2019-08-21 19:08:56 +02:00
Jacob Heun
3eef695bc0
fix: improve config defaults (#409)
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.
2019-08-21 16:44:30 +02:00
Jacob Heun
b3deb356f1
fix: reference files directly to avoid npm install failures (#408) 2019-08-21 10:23:06 +02:00
Jacob Heun
299cfefa01 chore: remove webrtcsupport 2019-08-20 17:34:55 +02:00
a1300
b0f124b5ff fix: pubsub configuration (#404)
* fix: add pubsub default config (#401)

License: MIT
Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net>

* docs: add default pubsub config to README (#401)

License: MIT
Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net>

* fix: pass config to provided PubSub (#401)

License: MIT
Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net>

* docs: adapt pubsub/example for new config (#401)

License: MIT
Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net>

* Update examples/pubsub/README.md

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>

* test: add pubsub config tests (#401)

License: MIT
Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net>
2019-08-19 17:06:08 +02:00
Jacob Heun
b294301456
refactor: add core modules to libp2p (#400)
* 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
2019-08-16 17:30:03 +02:00
Jacob Heun
fd738f9d51
refactor: add js-libp2p-switch to the libp2p codebase (#388)
Co-authored-by: Alan Shaw <alan.shaw@protocol.ai>
Co-authored-by: Alan Shaw <alan@tableflip.io>
Co-authored-by: Arnaud <arnaud.valensi@gmail.com>
Co-authored-by: David Dias <daviddias.p@gmail.com>
Co-authored-by: David Dias <mail@daviddias.me>
Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
Co-authored-by: Francisco Baio Dias <xicombd@gmail.com>
Co-authored-by: Friedel Ziegelmayer <dignifiedquire@gmail.com>
Co-authored-by: Haad <haadcode@users.noreply.github.com>
Co-authored-by: Hugo Dias <mail@hugodias.me>
Co-authored-by: Hugo Dias <hugomrdias@gmail.com>
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
Co-authored-by: Kevin Kwok <antimatter15@gmail.com>
Co-authored-by: Kobi Gurkan <kobigurk@gmail.com>
Co-authored-by: Maciej Krüger <mkg20001@gmail.com>
Co-authored-by: Matteo Collina <matteo.collina@gmail.com>
Co-authored-by: Michael Fakhry <fakhrimichael@live.com>
Co-authored-by: Oli Evans <oli@tableflip.io>
Co-authored-by: Pau Ramon Revilla <masylum@gmail.com>
Co-authored-by: Pedro Teixeira <i@pgte.me>
Co-authored-by: Pius Nyakoojo <piusnyakoojo@gmail.com>
Co-authored-by: Richard Littauer <richard.littauer@gmail.com>
Co-authored-by: Sid Harder <sideharder@gmail.com>
Co-authored-by: Vasco Santos <vasco.santos@ua.pt>
Co-authored-by: harrshasri <35241544+harrshasri@users.noreply.github.com>
Co-authored-by: kumavis <kumavis@users.noreply.github.com>
Co-authored-by: ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>
2019-08-08 19:01:16 +02:00
Jacob Heun
ff7a6c86a0
fix: promisified methods (#398)
* 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
2019-08-06 10:53:23 +02:00
Jacob Heun
684f283aec
chore: update switch (#395)
BREAKING CHANGE: switch configuration has changed.
'blacklistTTL' is now 'denyTTL' and 'blackListAttempts' is now 'denyAttempts'
2019-08-01 17:15:02 +02:00
Jacob Heun
f4f3f0f03a
fix: pubsub default config (#393)
* 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
2019-07-31 18:47:30 +02:00
Vasco Santos
791f39a09b feat: integrate gossipsub by default (#365)
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.
2019-07-31 09:38:14 +02:00
Jacob Heun
65d52857a5
test(fix): correct findProviders test for missing provider (#391)
* test(fix): correct findProviders test for missing provider

* chore: fix lint
2019-07-30 15:11:24 +02:00
Jacob Heun
9554b05c6f
fix: make subscribe comply with ipfs interface (#389)
BREAKING CHANGE: The ipfs interface specified that options
should be provided after the handler, not before.
https://github.com/ipfs/interface-js-ipfs-core/blob/v0.109.0/SPEC/PUBSUB.md#pubsubsubscribe

This corrects the order of parameters. See the jsdocs examples
for subscribe to see how it should be used.
2019-07-30 12:36:23 +02:00