Dmitriy Ryajov
eb49d4b218
no empty proto dials and add connect method
2020-02-25 17:52:08 -06:00
Dmitriy Ryajov
9efc08cb2f
fix : #83
2020-02-24 08:58:02 -06:00
Dmitriy Ryajov
6a7f9f058c
address review comments
2020-02-21 09:21:06 -06:00
Dmitriy Ryajov
fbcef69891
implicitelly dial pubsub if enabled
2020-02-21 09:21:06 -06:00
Giovanni Petrantoni
cb156f3260
Fix public() using proper bear mulgen
2020-02-18 09:35:14 -06:00
Giovanni Petrantoni
93a480e6f3
removed internal globals
2020-02-18 09:35:14 -06:00
Giovanni Petrantoni
e0e371994c
Remove implicit converters
2020-02-18 09:35:14 -06:00
Giovanni Petrantoni
f039853a19
Add few converters, finish c25519 integration tests
2020-02-18 09:35:14 -06:00
Giovanni Petrantoni
99a169b65d
Curve25519 integration tests (failing, something is wrong)
2020-02-18 09:35:14 -06:00
Giovanni Petrantoni
2103aa59f3
Add chachapoly proper test
2020-02-18 09:35:14 -06:00
Giovanni Petrantoni
6ba274de27
Fix misleading header
2020-02-18 09:35:14 -06:00
Giovanni Petrantoni
f47fb628f0
Fix curve mulgen iterate/derive
2020-02-18 09:35:14 -06:00
Giovanni Petrantoni
8dec368878
Add Curve25519 (BearSSL) required operations for noise
2020-02-18 09:35:14 -06:00
Giovanni Petrantoni
71998ffc67
Start ChaCha20Poly1305 integration (BearSSL)
2020-02-18 09:35:14 -06:00
Dmitriy Ryajov
1a987a9c5b
fix: delete mplex channel
2020-02-16 13:51:03 -06:00
Dmitriy Ryajov
65ed2c7cee
make code more robust
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
9023bf786d
remove sleeps
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
acdaeb8f5d
working out synchronization issues
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
b1dd564c32
make sure we don't exit the handler prematurely
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
f9ad113d11
don't send close message if remote closed
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
f767614827
remove unnecesary async lock
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
934c858542
increase timeout to allow floodsub to finish
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
26a4510377
remove unnecesary nil check in peerinfo
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
0349165830
typo
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
7f8eb0272e
cleanup and fix tests
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
6316b07e81
don't crash when stringifying nil peerinfo
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
4faf35c52c
throw exception if handshake failed
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
f4e9bc8bfb
remove sleepAsync for synchronization
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
53e163abf2
check for size bounds when reading varints
2020-02-16 11:31:35 -06:00
Dmitriy Ryajov
94fc4e6fd2
don't use sleeps for synchronization
2020-02-16 11:31:35 -06:00
Giovanni Petrantoni
39dc9ad8a3
Revert "Implement timeout in mplex in order to read reliably close state"
...
This reverts commit 314cb6e6bffe122bcfbd155a4ef830849ace66ef.
2020-02-12 11:57:38 -05:00
Giovanni Petrantoni
11bd55308f
Revert "Properly use already specified MaxReadWriteTime as timeout"
...
This reverts commit 8f5dd75e7f28da08de2bf393b93cd290b82ed78b.
2020-02-12 11:57:38 -05:00
Giovanni Petrantoni
ea0d167285
Fix max size write mplex test
2020-02-12 11:57:38 -05:00
Giovanni Petrantoni
cf5dd27e57
Properly use already specified MaxReadWriteTime as timeout
2020-02-12 11:57:38 -05:00
Giovanni Petrantoni
4034dfae19
Implement timeout in mplex in order to read reliably close state
2020-02-12 11:57:38 -05:00
Giovanni Petrantoni
136ac3f550
Use already existing error for channel push over size
2020-02-12 11:57:38 -05:00
Giovanni Petrantoni
f9cbdc252f
Improve connection.nim read error clarity when buffer overflow
2020-02-12 11:57:38 -05:00
Giovanni Petrantoni
120ba0d528
Add a safety check on message size limit when pushing new data in mplex
2020-02-12 11:57:38 -05:00
Giovanni Petrantoni
3531ebf772
Fix typo
2020-02-12 11:57:38 -05:00
cheatfate
5b6f4bf5fa
Export MultiAddress pattern procedures.
2020-02-12 12:04:12 +02: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
Giovanni Petrantoni
23712ecf3b
Lazy channels ( #78 )
...
* Implemented lazy stream opening for mplex connections
* Properly fix newStream usage
* Make lazy channel open optional
* Add Lazy channel test
* Cleanup mplex test
* Move lazyness properly into LPChannel
* Connection writeLp back to proc
2020-02-11 12:30:36 -05:00
Dmitriy Ryajov
88a030d8fb
fix: removing timeouts from conn
2020-02-05 20:38:43 +01:00
Dmitriy Ryajov
2232ca598e
don't timeout in pubsub
2020-02-04 17:59:57 +01:00
Zahary Karadjov
1bd933cd5a
More precise tracing
2020-02-04 17:27:32 +01:00
Zahary Karadjov
7bd305471c
Make sure the library can compile with json logging in trace mode
2020-02-04 15:17:39 +01:00
Dmitriy Ryajov
691efaa8a1
dont use result
2020-01-30 09:30:08 -06:00
Dmitriy Ryajov
171d60fb52
fix: reraise exception in readLp
2020-01-30 09:30:08 -06:00
cheatfate
06886290dd
Add links to specifications to varint comments.
2020-01-29 11:14:25 +02:00
Eugene Kabanov
d902127595
Fix LibP2P varint implementation to follow latest specification. ( #65 )
...
* Fix LibP2P varint implementation to decode only minimal valus.
2020-01-28 16:29:42 +01:00
Dmitriy Ryajov
007b0219f3
use ECDSA as defaults, faster in tests
2020-01-09 12:55:21 -06:00
Dmitriy Ryajov
667691f784
send messages in batches
2020-01-09 12:55:21 -06:00
Dmitriy Ryajov
cd8961cfb9
close and cleanup connections
2020-01-09 12:55:21 -06:00
Dmitriy Ryajov
c6561b8851
add timeouts to connection/secio
2020-01-09 12:55:21 -06:00
cheatfate
107e71203d
Fix #61 .
2020-01-09 17:38:10 +02:00
Dmitriy Ryajov
58cdefac21
don't expose private api
2019-12-24 10:35:35 -06:00
Dmitriy Ryajov
0fb1f1c5b8
strenghten pubsub interop testing
2019-12-24 10:35:35 -06:00
Dmitriy Ryajov
8714c66353
allow empty protocol string in dial
2019-12-24 10:35:35 -06:00
Dmitriy Ryajov
68cc57669e
Feat/pubsub validators ( #58 )
...
* feat: adding validator hooks to pubsub
* expose add/remove validators on switch
* do less unnecessary copyng
2019-12-16 23:24:03 -06:00
Dmitriy Ryajov
b6b0cdea98
fix: inconsistent error handling ( #56 )
...
* fix: inconsistent error handling
* fixing a few more returns
* remov reduntant returns
* feat: dont sleep in readLoop
2019-12-13 09:25:07 -06:00
Yuriy Glukhov
e0aae6d8ac
Moved base32, 58 and 64 to stew
2019-12-13 16:00:39 +02: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
77e866d29a
Address review comments
2019-12-09 19:17:29 +02: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
5f6fcc3d90
extract public and private keys fields from peerid ( #44 )
...
* extract public and private keys fields from peerid
* allow assigning a public key
* cleaned up TODOs
* make pubsub prefix a const
* public key should be an `Option`
2019-12-07 10:36:39 -06: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
903e79ede1
Feat/conn cleanup ( #41 )
...
Backporting proper connection cleanup from #36 to align with latest chronos changes.
* add close event
* use proper varint encoding
* add proper channel cleanup in mplex
* add connection cleanup in secio
* tidy up
* add dollar operator
* fix tests
* don't close connections prematurely
* handle closing streams properly
* misc
* implement address filtering logic
* adding pipe tests
* don't use gcsafe if not needed
* misc
* proper connection cleanup and stream muxing
* re-enable pubsub tests
2019-12-03 22:44:54 -06:00
Dmitriy Ryajov
1df16bdbce
set log level to trace - not enabled by default
2019-12-02 18:43:21 -06:00
Zahary Karadjov
f9eed172d4
Don't handle Exception
2019-12-03 01:26:59 +02:00
Dmitriy Ryajov
26366f8b56
use `Exception` to emulate `getCurrentException()`
2019-12-03 01:26:59 +02:00
Dmitriy Ryajov
a5b051a14f
fix: use exception `msg` field in logs
2019-12-03 01:26:59 +02:00
Dmitriy Ryajov
9e437a681b
fix: revert to proper exception handling
2019-12-03 01:26:59 +02:00
cheatfate
dde8c01448
Workaround for https://github.com/nim-lang/Nim/issues/12764 .
...
Remove usage of getCurrentException().
2019-11-28 20:58:56 +02:00
Dmitriy Ryajov
fe3c1d45bb
misc: removing unneded accessors
2019-11-06 12:13:21 -06:00
Ștefan Talpalaru
f3fc763895
daemonapi: direct p2pd's output to parent's streams
2019-11-05 21:16:56 +01:00
cheatfate
76fee97724
Fix MultiAddress.init(PeerID) compilation problem.
2019-11-04 20:57:17 +02:00
cheatfate
833e8c9406
Fix overflow problem.
...
Fix compilation warnings.
2019-10-29 20:51:48 +02:00
Dmitriy Ryajov
400218ba01
fixing remaining overflows in BE/LE
2019-10-29 11:02:28 -06:00
Dmitriy Ryajov
541f0f2a41
avoid buffer overflow on BE/LE conversions
2019-10-29 10:10:19 -06:00
cheatfate
cc0d45c482
Add protoAddress() utility procedure.
2019-10-29 15:38:37 +02:00
Dmitriy Ryajov
21af081066
remove init in favor of upstream init
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
a4431a86a1
fixing windows build issue
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
0b77c8c6e3
add init from TransportAddress to multiaddress
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
ae7b354819
unused directory
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
9e16fd020e
use PeerID `==` for comparisons
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
018da65708
compare peer string ids, rather than keys
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
3194e3ac5b
fixes after building with 0.20.2
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
bb277d4b56
readLp should warn on ignored exceptions
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
464d75d159
minor style fixes
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
2066e81658
set default timeout to 10 secs
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
1d4b51413e
option to allow triggering own handlers on publish
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
37d7a03fba
use a timed cache in floodsub
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
e98ec9fd49
use doAssert for release asserts
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
f190c155d3
don't throw on missing peer
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
3b9d34116d
decrease floodsub traffic
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
f9a04dbb9d
todo: poll should allow for timeouts
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
cfd31c5251
properly handle empty messages
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
6cfbf2c124
don't send messages to self
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
a01d1db6a0
prperly close and chronos connections
2019-10-11 08:15:24 +09:00
Dmitriy Ryajov
968fd85d49
properly exit readLoop on error/stream end
2019-10-11 08:15:24 +09:00