Commit Graph

422 Commits

Author SHA1 Message Date
0614b0d44e secio: don't panic in agree_ephemeral. (#480)
Given that echoing back our local key and nonce would result in equal
digest values, we should treat this as an error instead of panicking.
2018-09-14 11:37:40 +02:00
b2756c8fa9 Make Multiaddr::iter borrow data (#478)
* Use `unsigned-varint` crate.

* Implement `Display` for `Protocol`.

Gives `ToString` for free.

* Use `Cow` in `AddrComponent`.

* Add `AddrComponent::acquire`.

* Document `AddrComponent::acquire`.
2018-09-14 10:21:14 +02:00
5980a4538e Secp256k1 key generation (#474) 2018-09-13 10:26:52 +02:00
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
5ecdb71c29 Populate TcpConfig with more config (#454) 2018-09-11 12:04:35 +02:00
fd4b7488be Add some comments about the notification behaviour of muxers (#453) 2018-09-11 11:17:44 +02:00
cfdfca1a06 Similar to #469, consider endpoint while retaining. (#470) 2018-09-10 14:03:38 +02:00
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
304e9c72c8 Report the entire peers after a result (#467) 2018-09-07 16:46:34 +02:00
0a3d4cdfad Revert "remove rustc-serialize (#359) (#386)" (#466)
This reverts commit 73996885cb.
2018-09-07 14:05:42 +02:00
e45dce2d9a Switch to twofish by default (#465) 2018-09-06 17:35:25 +02:00
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
601de6ab70 Minor fix for concat_comma (#464) 2018-09-06 16:31:15 +02:00
bccd710fb4 Limit upload frame sizes to 1024 in mplex (#462) 2018-09-06 15:43:49 +02:00
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
ea1f172397 Implement Send everywhere (#458) 2018-09-06 09:54:35 +02:00
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
e2960b4317 Add support for twofish cipher (#457) 2018-09-05 02:15:16 +02:00
ba4bd79fd9 Fix mplex notifications system (#455)
* Fix mplex notifications system

* Some fixes
2018-09-05 01:53:39 +02:00
a6c82e6ca1 Use Bytes instead of BytesMut in mplex. (#456) 2018-09-04 16:12:58 +02:00
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
ee9be6f0c9 add must_use for Future (#450) 2018-09-04 12:30:57 +02:00
02576eecf1 Downgrade ring to 0.12 (#448) 2018-09-03 20:44:55 +02:00
5f0347a8b7 Cap the allocated buffer capacity in mplx (#449) 2018-09-03 18:33:51 +02:00
cd1d81b5d0 Update unsigned-varint crate to v0.2.0 (#447) 2018-09-03 17:19:03 +02:00
f787c80a42 Merge the changes from polkadot-2 into master (#446) 2018-09-03 16:46:15 +02:00
35e005879b Simplify the mplex codec implementation (#445) 2018-09-03 15:41:36 +02:00
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
ccc5aacafc Fix #440 (#441)
* Fix #440

* Ignore failing test
2018-09-03 10:25:16 +02:00
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
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
f457ca5490 Correctly encode and decode multistream-select ls. (#438) 2018-08-30 23:13:06 +02:00
4798952e2f Fix rust-libp2p issue #429 (floodsub fails to decode PeerId) (#430) 2018-08-29 11:37:07 +02:00
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
f5ce93c730 Replaced tokio_time::Deadline with tokio::timer::Timeout (#432) 2018-08-28 15:38:08 +02:00
c77b1f5a0a Better documentation (#391)
* Better documentation

* Minor
2018-08-22 10:46:23 +02:00
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
6c7ae04349 Allow configuring mplex (#411) 2018-08-17 09:39:37 +02:00
c6e28dcc45 Add Transport::map_err_dial (#392) 2018-08-15 17:42:34 +02:00
6200055161 Add multiaddr! macro (#413) 2018-08-15 17:19:19 +02:00
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
bd73f60358 Add some Send implementations to Futures (#412) 2018-08-14 15:23:30 +02:00
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
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
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
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
d4b98e8646 Add upgrade::loop_upg (#394) 2018-08-10 16:55:47 +02:00
66db7f89b7 Externalise unsigned-varint crate. (#329) 2018-08-10 16:35:41 +02:00
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
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