Commit Graph

36 Commits

Author SHA1 Message Date
Dmitriy Ryajov 5b28e8c488
Cleanup lpstream, Connection and BufferStream (#228)
* count published messages

* don't call `switch.dial` in `subscribeToPeer`

* don't use delegation in connection

* move connection out to own file

* don't breakout on reset

* make sure to call close on secured conn

* add lpstream tracing

* don't breackdown by conn id

* fix import

* remove unused lable

* reset  connection on exception

* add additional metrics for skipped messages

* check for nil in secure.close
2020-06-19 11:29:43 -06:00
Giovanni Petrantoni 37b98ad45c
Secure managers are now sorted, giving priority to noise (#191)
* Secure managers are now sorted, giving priority to noise

* fix nimble test command

* Fix native tests

* fix directchat sample

* Could not write to connection - reduce verbosity

* fix interop testing

* Remove more tables

* test interop fixes

* directchat fix

* fix interop/remove some deprecation
2020-06-01 08:41:32 +02:00
Giovanni Petrantoni 6affcda937
Less exceptions more results (#188)
* Less exceptions more results

* Fix daemonapi and interop tests

* Add multibase

* wip multiaddress

* fix the build, consuming new result types

* fix standard setup

* Simplify match, rename into MaError, add more exaustive err text

* Fix the CI issues

* Fix directchat build

* daemon api fixes

* better err messages formatting

Co-authored-by: Zahary Karadjov <zahary@gmail.com>
2020-05-31 16:22:49 +02:00
Dmitriy Ryajov 9cf1fd0216
remove generic constructor and expose serverflags (#176)
* remove generic constructor and expose serverflags

* fix transport constructor

* fix merge issues
2020-05-18 13:04:05 -06:00
Giovanni Petrantoni 7dcb807f64
Crypto utilities resultification (#150) 2020-05-18 07:25:55 +02:00
Jacek Sieka 3053f03814 fix varint issues
* fixes #111
2020-05-11 09:12:23 -06:00
Giovanni Petrantoni 4c6a123d31
Add chronos trackers and used them to sanitize resource disposal (#131)
* Add chronos trackers and used them to sanitize resource disposal

* Chronos trackers for transport tests wip

* No more chronos leaks in testtransport

* Make tcp transport and test more robust when closing

* Test async leaking tracking wip

* Fix a regression in wire connect

* Add chronos trackers to more tests and sanitize resource closure

* Wip fixing floodsub tests

* Floodsub wip

* Made floodsub basically deterministic, hit a nim bug with captures tho

* Wrap up floodsub tests refactor

* Wrapping up

* Add allFuturesThrowing utility

* Fix missing allFuturesThrowing in noise tests!

* Make tests green

* attempt fixing gossipsub failing cases

* Make sure to check also fanout in waitSub

* More verbose traces

* Gossipsub test improvments

* Refactor TcpTransport remove asyncCheck

* Add Connection trackers

* Add stricter connection tracking, wip mplex fix

* More asynccheck removal, in order to avoid connection leaks

* bump chronicles requirement

* Enable tracker dump to check CI output

* Wait for more futures in testmplex

* Remove tracker dump messages

* add tryAndWarn utility, fix mplex issue with go interop

* All allFuturesThrowing to directchat too

* make sure to cleanup on transport close
2020-04-21 10:24:42 +09:00
李婷婷 d1a7c08a0a
Add the tutorial folder to store the sample code and modify directchat to make it more beginner friendly (#126)
* update readme and organize the example folder


Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
2020-04-08 19:21:06 +02:00
李婷婷 b210f987ce
Update Readme (#103)
* update readme and organize the example folder

* adding package list

* add packages done

* basic readme done

* fix the go-daemon example folder

* add go-daemon folder in readme

* fix readme icon

* add badges

* add nim min version

* Update README background

Co-Authored-By: Dmitriy Ryajov <dryajov@gmail.com>

* fix all the comments

* Update README.md wording

Co-Authored-By: Dmitriy Ryajov <dryajov@gmail.com>

* fix file path in examples/

Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
2020-03-16 08:43:08 +01:00
Eugene Kabanov 540e79a430
Add peer lifetime feature for PeerInfo. (#77)
* Add peer lifetime feature for PeerInfo.
Refactor peerinfo to use openarrays instead of sequences.
Fix tests and examples to use arrays instead of sequences.

* Add access to lifetime Future[T] itself.
2020-02-11 12:53:39 -05:00
Dmitriy Ryajov 293a219dbe
Cleanup (#55)
* fix: don't allow replacing pubkey

* fix: several small improvements

* removing pubkey setter

* improove error handling

* remove the use of Option[T] if not needed

* don't use optional

* fix-ci: temporarily pin p2pd to a working tag

* fix example to comply with latest changes

* bumping p2pd again to a higher version
2019-12-10 14:50:35 -06:00
Zahary Karadjov 454f658ba8
Fixes and tweaks related to the beacon node integration
* Bugfix: Dialing an already connected peer may lead to crash

* Introduced a standard_setup module allowing to instantiate
  the `Switch` object in an easier manner.

* Added `Switch.disconnect(peer)`

* Trailing space removed (sorry about polluting the diff)
2019-12-08 23:58:43 +02:00
Dmitriy Ryajov e623e70e7b
PubSub (Gossip & Flood) Implementation (#36)
This adds gossipsub and floodsub, as well as basic interop testing with the go libp2p daemon. 

* add close event

* wip: gossipsub

* splitting rpc message

* making message handling more consistent

* initial gossipsub implementation

* feat: nim 1.0 cleanup

* wip: gossipsub protobuf

* adding encoding/decoding of gossipsub messages

* add disconnect handler

* add proper gossipsub msg handling

* misc: cleanup for nim 1.0

* splitting floodsub and gossipsub tests

* feat: add mesh rebalansing

* test pubsub

* add mesh rebalansing tests

* testing mesh maintenance

* finishing mcache implementatin

* wip: commenting out broken tests

* wip: don't run heartbeat for now

* switchout debug for trace logging

* testing gossip peer selection algorithm

* test stream piping

* more work around message amplification

* get the peerid from message

* use timed cache as backing store

* allow setting timeout in constructor

* several changes to improve performance

* more through testing of msg amplification

* prevent gc issues

* allow piping to self and prevent deadlocks

* improove floodsub

* allow running hook on cache eviction

* prevent race conditions

* prevent race conditions and improove tests

* use hashes as cache keys

* removing useless file

* don't create a new seq

* re-enable pubsub tests

* fix imports

* reduce number of runs to speed up tests

* break out control message processing

* normalize sleeps between steps

* implement proper transport filtering

* initial interop testing

* clean up floodsub publish logic

* allow dialing without a protocol

* adding multiple reads/writes

* use protobuf varint in mplex

* don't loose conn's peerInfo

* initial interop pubsub tests

* don't duplicate connections/peers

* bring back interop tests

* wip: interop

* re-enable interop and daemon tests

* add multiple read write tests from handlers

* don't cleanup channel prematurely

* use correct channel to send/receive msgs

* adjust tests with latest changes

* include interop tests

* remove temp logging output

* fix ci

* use correct public key serialization

* additional tests for pubsub interop
2019-12-05 20:16:18 -06:00
Dmitriy Ryajov 018da65708 compare peer string ids, rather than keys 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 759355b364 use discard for unused results 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 06b759e049 review cleanup 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 3c2009c85e rename chat example to direct chat 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 9d93301a3a handle /connect command properly 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov a1ee339680 feat: native chat clean up 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 2c53dd27f8 cleanup and error handling 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 72c4115c95 wip: native libp2p chat sample 2019-10-11 08:15:24 +09:00
cheatfate 8c4c2159ed Fix #25. 2019-08-14 08:31:06 +03:00
cheatfate d7a7f8102d
Change PeerID type from distinct type.
Fix MultiAddress compilation error.
Fix chat example.
2019-03-05 22:28:46 +02:00
cheatfate a96718cf9e
Add PeerID support to multiaddress.
Change some PeerID api.
Some fixes to chat.
2019-03-05 14:09:26 +02:00
cheatfate d7d9d7bd40
Fix daemonapi and examples. 2019-03-05 01:57:18 +02:00
cheatfate 77f34af737
Fix testdaemon.nim. 2019-03-04 20:51:10 +02:00
cheatfate 53467d028f
Fix examples for new PeerID. 2019-03-04 20:28:59 +02:00
cheatfate 1e6c8b2171
Fix examples.
Add peer.nim.
Switch daemonapi to use PeerID from peer.nim.
2019-03-04 20:22:38 +02:00
cheatfate e9785bb509 Make unix socket name generation more reliable (depending on process id).
Add examples of bootstrap node and gossipsub node.
2018-12-18 16:31:58 +02:00
cheatfate 9d55f41909 Update example chat /consearch now shows if peers are supporting p2p-circuit.
Add utility procedures for multiaddress.
2018-11-27 22:58:16 +02:00
cheatfate ff965830d8 Fix chat example to show peers in base58. 2018-11-27 14:42:49 +02:00
cheatfate b4e9a7b8a6 Fix daemonapi connect/streamOpen to support timeouts.
Add more commands to chat example.
2018-11-27 14:33:41 +02:00
cheatfate 98aa3ed281 Add VBuffer implementation.
Add MultiAddress implementation and tests.
Adapt chat to use /p2p-circuit
2018-11-27 14:16:04 +02:00
cheatfate 9edc823b6c Some fixes to chat, and one more test for bad cid provide. 2018-11-22 17:35:44 +02:00
cheatfate 10548f9b1b Enable bootstrap. 2018-11-22 16:16:34 +02:00
cheatfate 66973aed3f Simple chat. 2018-11-22 16:12:46 +02:00