619 Commits

Author SHA1 Message Date
Toralf Wittner
6a5681aed7
secio: Add NULL cipher and allow more configuration. (#468)
* Introduce NULL cipher and allow more configuration.

* Back to using the hash-code for handshake.

Using `Endpoint` would be incompatible with the existing protocol.

* Add comments.
2018-09-12 09:10:05 +02:00
Pierre Krieger
5ecdb71c29
Populate TcpConfig with more config (#454) 2018-09-11 12:04:35 +02:00
Pierre Krieger
fd4b7488be
Add some comments about the notification behaviour of muxers (#453) 2018-09-11 11:17:44 +02:00
Toralf Wittner
cfdfca1a06
Similar to #469, consider endpoint while retaining. (#470) 2018-09-10 14:03:38 +02:00
Toralf Wittner
ec6ec92a79
mplex: fix destroy_substream (#469)
Retain all incoming buffer elements with different substream ID or equal
Endpoint. The latter was previously not considered which could result in
the removal of data for another substream with same ID but opposite
Endpoint.
2018-09-10 10:21:19 +02:00
Pierre Krieger
304e9c72c8
Report the entire peers after a result (#467) 2018-09-07 16:46:34 +02:00
Pierre Krieger
0a3d4cdfad
Revert "remove rustc-serialize (#359) (#386)" (#466)
This reverts commit 73996885cb2d645ee91361204c33e7039290aabc.
2018-09-07 14:05:42 +02:00
Pierre Krieger
e45dce2d9a
Switch to twofish by default (#465) 2018-09-06 17:35:25 +02:00
Pierre Krieger
381c071cbc
Add BoxedMuxed transport (#459)
* Add BoxedMuxed transport

* Extend to both muxed and non-muxed versions

* Style

* Implement Debug for boxed transports
2018-09-06 16:59:47 +02:00
Pierre Krieger
601de6ab70
Minor fix for concat_comma (#464) 2018-09-06 16:31:15 +02:00
Pierre Krieger
bccd710fb4
Limit upload frame sizes to 1024 in mplex (#462) 2018-09-06 15:43:49 +02:00
Toralf Wittner
5c35047ee3 Change stream ID handling to consider flags. (#436)
Replaces the former odd/even distinction of IDs. However we still increment stream IDs by 2
for backwards compatibility.
2018-09-06 13:59:14 +02:00
Pierre Krieger
ea1f172397
Implement Send everywhere (#458) 2018-09-06 09:54:35 +02:00
Pierre Krieger
bca1083d9c
Make the Futures in map_err Send-friendly (#418)
* Make the Futures in map_err Send-friendly

* Address concern
2018-09-05 09:09:32 +02:00
Pierre Krieger
e2960b4317
Add support for twofish cipher (#457) 2018-09-05 02:15:16 +02:00
Pierre Krieger
ba4bd79fd9
Fix mplex notifications system (#455)
* Fix mplex notifications system

* Some fixes
2018-09-05 01:53:39 +02:00
Toralf Wittner
a6c82e6ca1
Use Bytes instead of BytesMut in mplex. (#456) 2018-09-04 16:12:58 +02:00
Pierre Krieger
75ceba7809
The SwarmFuture is now a Stream (#442)
* The SwarmFuture is now a Stream

* Return the produced future in the message

* Remove IncomingConnection event

* Pass error when failing to dial

* Fix loop break mistake

* Fix concern

* Rename SwarmFuture to SwarmEvents

* Increase type length limit

* Remove todo
2018-09-04 14:53:27 +02:00
Guanqun Lu
ee9be6f0c9 add must_use for Future (#450) 2018-09-04 12:30:57 +02:00
Pierre Krieger
02576eecf1
Downgrade ring to 0.12 (#448) 2018-09-03 20:44:55 +02:00
Pierre Krieger
5f0347a8b7
Cap the allocated buffer capacity in mplx (#449) 2018-09-03 18:33:51 +02:00
Toralf Wittner
cd1d81b5d0
Update unsigned-varint crate to v0.2.0 (#447) 2018-09-03 17:19:03 +02:00
Pierre Krieger
f787c80a42 Merge the changes from polkadot-2 into master (#446) 2018-09-03 16:46:15 +02:00
Pierre Krieger
35e005879b
Simplify the mplex codec implementation (#445) 2018-09-03 15:41:36 +02:00
Toralf Wittner
b5acf226f9
multistream-select: Include \n in length. (#439)
* multistream-select: Include `\n` in length.

* Add comment to explain the +1.

* Re-enable test.
2018-09-03 11:13:42 +02:00
Pierre Krieger
ccc5aacafc Fix #440 (#441)
* Fix #440

* Ignore failing test
2018-09-03 10:25:16 +02:00
Pierre Krieger
0e1483f02e Rework the StreamMuxer trait (#437)
* Stronger typing for the swarm handler future
* The swarm future is now a swarm stream of events
* Rewrite StreamMuxer in core
* Update libp2p_mplex for the new stream muxer
* Update yamux for new stream muxer
2018-08-31 10:31:34 +02:00
Toralf Wittner
c02dea8128
Introduce several concrete future types. (#433)
* multisteam-select: introduce `DialerFuture`.

* multistream-select: add more concrete futures.

* multistream-select: add ListenerFuture.

* multistream-select: add ListenerSelectFuture

* Formatting.

* Add DialerSelectFuture type alias.

* Add UpgradeApplyFuture and NegotiationFuture.

* In iterator wrappers also pass-through size_hint.

* Minor refactoring.

* Address review comments.

* Add some comments.

* Hide state enums in wrapping structs.
2018-08-30 23:25:16 +02:00
Toralf Wittner
f457ca5490
Correctly encode and decode multistream-select ls. (#438) 2018-08-30 23:13:06 +02:00
Eugene Chupriyanov
4798952e2f Fix rust-libp2p issue #429 (floodsub fails to decode PeerId) (#430) 2018-08-29 11:37:07 +02:00
Benjamin Kampmann
2ea49718f3
Clean up directory structure (#426)
* Remove unused circular-buffer crate
* Move transports into subdirectory
* Move misc into subdirectory
* Move stores into subdirectory
* Move multiplexers
* Move protocols
* Move libp2p top layer
* Fix Test: skip doctest if secio isn't enabled
2018-08-29 11:24:44 +02:00
Eugene Chupriyanov
f5ce93c730 Replaced tokio_time::Deadline with tokio::timer::Timeout (#432) 2018-08-28 15:38:08 +02:00
Pierre Krieger
c77b1f5a0a Better documentation (#391)
* Better documentation

* Minor
2018-08-22 10:46:23 +02:00
Pierre Krieger
7aa08917ea Simplify the implementation of peer_info (#327)
* Simplify the implementation of peer_info
* Add Serde-Support to MultiAddr
2018-08-20 12:04:22 +02:00
Pierre Krieger
6c7ae04349 Allow configuring mplex (#411) 2018-08-17 09:39:37 +02:00
Pierre Krieger
c6e28dcc45 Add Transport::map_err_dial (#392) 2018-08-15 17:42:34 +02:00
Pierre Krieger
6200055161 Add multiaddr! macro (#413) 2018-08-15 17:19:19 +02:00
cheme
5b712e559a Complements to #389 (#415)
* Copyright and test module

* Cosmetic changes

* Put back static constraint in mplex (in case it might be needed in other crates).

* 2018, Send on box.
2018-08-15 17:00:57 +02:00
Pierre Krieger
bd73f60358 Add some Send implementations to Futures (#412) 2018-08-14 15:23:30 +02:00
Jun Jiang
e5afab104a Fix compiling error on windows (#410)
* Fix compiling error on windows

* Fix JsonFileDatastore tests

* Update tempfile cargo, Refactor JsonFileDatastore tests
2018-08-14 11:31:05 +02:00
Pierre Krieger
b673209839 Fixes to the mplex implementation (#360)
* Fixes to the mplex implementation
* Fix mem leak and wrong logging message
* Correctly handle Close and Reset
* Check the even-ness of the substream id
2018-08-13 11:29:07 +02:00
cheme
73996885cb remove rustc-serialize (#359) (#386)
* Replace rust-crypto dependency by RustCrypto project crate aes-ctr

* Support for x86 build supporting both aesni and aessoft at runtime.
Feature gated behind 'aes-all'.
Building requires RUSTFLAGS="-C target-feature=+aes,+ssse3" and RUSTDOCFLAGS="-C target-feature=+aes,+ssse3".
Only support x86 case.

* Change CI to build with aes ni on all-features

* Switch aes-all logic (is_x86 runtime test did not work as I thought when
RUSTC aes and sse are enabled).
To build with aes-all, aes and sse flag should not be set.

* Use latest aesni from crates.io (with pr to disable compile time
checks).

* Replace rust-crypto dependency by RustCrypto project crate aes-ctr

* Support for x86 build supporting both aesni and aessoft at runtime.
Feature gated behind 'aes-all'.
Building requires RUSTFLAGS="-C target-feature=+aes,+ssse3" and RUSTDOCFLAGS="-C target-feature=+aes,+ssse3".
Only support x86 case.

* Change CI to build with aes ni on all-features

* Switch aes-all logic (is_x86 runtime test did not work as I thought when
RUSTC aes and sse are enabled).
To build with aes-all, aes and sse flag should not be set.

* Use latest aesni from crates.io (with pr to disable compile time
checks).
2018-08-10 18:27:20 +02:00
Pierre Krieger
d94fe1b831 Use a Multihash in AddrComponent::P2P, drop cid (#407)
* Use a Multihash in AddrComponent::P2P
* Remove the cid crate from the repo
2018-08-10 17:47:02 +02:00
Pierre Krieger
d4b98e8646 Add upgrade::loop_upg (#394) 2018-08-10 16:55:47 +02:00
Toralf Wittner
66db7f89b7 Externalise unsigned-varint crate. (#329) 2018-08-10 16:35:41 +02:00
Pierre Krieger
eb53ea2515
Add CircleCI build for win32 (#398)
* Add CircleCI build for win32

* Use cargo check instead

* Build for 32bits as well
2018-08-09 15:12:13 +02:00
Pierre Krieger
078fa1cb33
Rework the multihash crate (#403)
* Use Multihash and MultihashRef instead

* Don't use star imports

* Split EncodeError and DecodeError

* Add DecodeOwnedError

* Some cleanup

* Remove Hash::name()

* Some crate root documentation

* Add some more methods

* Fix tests

* Add PartialEq between Multihash and MultihashRef

* Fix the rest of the repo

* Rename hash_data() to digest()

* Add comment about varint

* Remove Error::description impls
2018-08-09 14:51:09 +02:00
Pierre Krieger
486a9694d9
Tcp refinements (#404)
* Improve nat_traversal

* Remove the Box for dialing

* Improve multiaddr_to_socketaddr

* Use ? on None

* Use a proper stream for TcpListenStream

* Rustfmt

* Use tk_listen for errors on the listener

* Minor changes

* Fix concerns
2018-08-09 14:04:15 +02:00
Pierre Krieger
5546bb9dfd
Use tk_listen to absorb errors on the TcpListener (#402)
* Use tk_listen to absorb errors on the TcpListener

* Put sleep_on_error in TcpConfig
2018-08-08 17:54:15 +02:00
Pierre Krieger
c3655226bb Add a UNIX transport (#308)
* Use the new version of tokio
* Add a UNIX transport
2018-08-08 12:38:29 +02:00