Commit Graph

1224 Commits

Author SHA1 Message Date
585c90a33c Add protocol to report external address view. (#566)
Add protocol to report external address view.

Address part of #443.
2018-10-28 11:02:26 +01:00
16d5bc777a Add a TransportExt trait (#533)
* Add a TransportExt trait

* Fix concerns

* Comment out with_rate_limit

* Remove example

* Address concerns and restore method
2018-10-26 11:07:59 +02:00
490ae980c7 #399 remove tokio_current_thread tests (#577)
* remove tokio_current_thread tests

* Review changes:
Removed newline
Moved uds tokio test crate to top to avoid self and keep with convention of other test crates
Removed sleep from uds test and block until all futures are completed.
2018-10-25 11:26:37 +02:00
4a894851ab Remove even more unused files (#581)
* Remove even more unused files

* Remove dummy.rs as well
2018-10-23 12:07:06 +02:00
de26ba1d2d Fix the polling process in handled node (#582) 2018-10-20 13:12:05 +02:00
46dd6b61b2 Fix panicking when Kad responder is destroyed (#575) 2018-10-18 17:03:47 +01:00
1e223f627d Remove other unused files (#570) 2018-10-18 15:21:14 +01:00
a77c1a6bf7 Fix panic in raw swarm (#571) 2018-10-18 09:42:20 +01:00
840663e181 Remove two unused files (#567) 2018-10-17 12:26:42 +01:00
5d1c54cc10 New core (#568)
* New core

* Fix lifetime requirements

* Remove identify transport

* Address &mut & ref ref mut

* Fix whitespaces
2018-10-17 10:17:40 +01:00
724d0f5d82 Remove the old API (#565)
* Remove the old API

* Fix integration test
2018-10-15 16:17:55 +01:00
2c98d06942 Change some nat_traversals to consider a prefix. (#550)
Change some `nat_traversal`s to consider a prefix.

Transports should consider only the relevant address prefix.
2018-10-15 16:29:32 +02:00
e179951c74 Add some documentation to listeners stream (#547)
* Add some documentation to listeners stream

* Fix concern
2018-10-15 11:12:40 +02:00
7d1a0238de Add shutdown functionality to NodeStream. (#560)
Add shutdown functionality to `NodeStream`.

Add `NodeStream::shutdown` to allow triggering the shutdown process,
and `NodeStream::poll_shutdown` as the internal way to drive any
potential shutdown to completion.
2018-10-15 10:42:11 +02:00
da05a10790 Shut down yamux and fix mplex shutdown. (#559)
mplex gets a new flag `is_shutdown` to keep track of when `shutdown` has
been called. We need to make certain that after the shutdown no more
`Sink::poll_complete` or `Sink::start_send` calls are being made which
may result in a panic.
2018-10-11 15:43:34 +02:00
7016b86b3a Add StreamMuxer::flush. (#534)
Update the `StreamMuxer` trait.

- `read_substream`, `write_substream` and `flush_substream` now return `Poll` instead of `Result`.
- A new `Shutdown` enum allows for half-closing of substreams and is used in `shutdown_substream`.
- `close_inbound` and `close_outbound` have been merged into `shutdown` which takes a `Shutdown` parameter to allow closing only one direction.
- Add a new `flush_all` method  to allow flushing after a series of actions (e.g. multiple `shutdown_substream`).

W.r.t. flushing the general idea is that normal use drains buffers over time. Shutting down a substream does not imply flushing, so can be followed by `flush_substream` or (if multiple substreams are to be shut down) a single `flush_all`. Shutting down the muxer itself proceeds likewise, i.e. `shutdown` followed by `flush_all`.
2018-10-11 10:35:14 +02:00
0c7f313146 Tests for nodes/listeners.rs (#541)
* Add unit tests for core::nodes::NodeStream

* Move DummyMuxer to core/tests

* Address grumbles

* Impl Debug for SubstreamRef<P>

* Add test for poll()

* Don't need to open a substream

* pretty printer test

* More tests for NodeStream poll()

* ListenerStream unit tests: transport() and listeners()

* Tests for nodes/listeners.rs

* Add a few tests to help illustrate the "drowning" behaviour of busy listeners

* Address grumbles

* Remove non-project specific stuff

* Address grumbles

* Prefer freestanding function
2018-10-10 16:27:07 +02:00
dec7cd13b2 Deny relative addresses for UNIX domain sockets (#548) 2018-10-10 13:17:26 +02:00
9bdaabc884 Optimise Multiaddr::append. (#549)
Append to the existing vector instead of allocating a temporary one and
copying bytes over.
2018-10-10 11:07:30 +02:00
fd4ae72f8c multistream-select: use FramedWrite from tokio-codec. (#539) 2018-10-10 09:16:21 +02:00
68632ce26b Fix secio compied with --no-default-features (#545) 2018-10-09 11:21:35 +02:00
276bc9c07a multiaddr: explain the use of &str for Unix. (#543)
multiaddr: explain the use of `&str` for `Unix`.

Closes #408.
2018-10-08 14:51:24 +02:00
f2c3a149d7 Model HandshakeContext with explicit state transitions. (#532)
Instead of having one struct with uninitialised fields
which are mutated, have explicit states and ensure that the types
show that there is no ambiguity which data is available or not.
Consequently, this removes quite a few `unwrap`/`expect` calls.
2018-10-08 14:37:36 +02:00
e05422c05f multiaddr: add support for onion protocol. (#542)
* multiaddr: add support for onion protocol.

* Comment `read_onion`.

* Split onion into address and port parts.
2018-10-08 11:13:00 +02:00
d81f4e264f Add unit tests for core::nodes::NodeStream (#535)
* Add unit tests for core::nodes::NodeStream

* Move DummyMuxer to core/tests

* Address grumbles

* Impl Debug for SubstreamRef<P>

* Add test for poll()

* Don't need to open a substream

* pretty printer test

* More tests for NodeStream poll()

* Remove contentious test of Debug
2018-10-05 11:55:32 +02:00
c032afbde5 Implement GET_PROVIDERS/ADD_PROVIDER Kademlia messages (#530)
* Implement GET_PROVIDERS/ADD_PROVIDER Kademlia messages

* Use multihash and peer id in protocol.rs

* Fix Kademlia example
2018-10-01 18:40:35 +02:00
e3efc2dc9a Make secio almost compile for asmjs/wasm (#519)
* Use the sha2 crate in the handshake

* Return a Digest in algo_support instead of a ring ref

* Switch to ed25519-dalek for keys

* Make ring more or less optional

* Switch to ed25519_dalek for the verification

* Extract the key exchange to its own module

* Remove the ring RNG from the handshake

* Some warning fixes and forgot file

* Move key exchange to own module

* Remove usage of ring::digest

* Remove ring from handshake entirely

* Implement ECDH for WebCrypto

* Remove the libp2p-secio feature

* Fix ring being included

* Address some concerns

* Provde some panics in WebCrypto

* Prove the Hmac panic

* Prove more panics
2018-10-01 15:42:40 +02:00
7208bba92b Make it possible to accept/deny nodes in CollectionsStream (#512)
* Provide poll() as a regular method when we can't fail

* Add a CollectionReachEvent that allows accepting

* Add small TODO in handled_node

* Implement Debug on collection events

* Implement Debug for CollectionStream

* Implement Debug for structs in handled_node_tasks

* Attempt to fix compilation errors with stable Rust

* Prove the unwrap
2018-10-01 14:49:17 +02:00
4ff7d686a4 Fix polling in handled_node.rs (#531) 2018-10-01 14:24:01 +02:00
a9eefe1015 Remove notifying tasks (#528) 2018-10-01 11:18:00 +02:00
895557cb82 Fix handler not properly shut down, and write test for this (#514)
* Fix handler not properly shut down, and write test

* Remove to_notify from the test
2018-10-01 11:17:34 +02:00
ad0807b3f3 Use unsigned-varints, add BLAKE2 support in multihash (#525)
* Add support for unsigned varints

* Depend on unsigned-varint 0.2 without default features

* Change hash code type from u8 to u64

* Fix hash codes and enum variants for BLAKE2 to fit the standard (see #524)

* Run cargo fmt on crate

* Expand hash_types test to include all variants

* Add support for BLAKE2b-512 and BLAKE2s-256

* Depend on blake2 crate 0.7 with no default features

* Update encode! macro for support for blake2 crate

* Update all tests to include BLAKE2b-512 and BLAKE2s-256

* Reduce hash code size from u64 to u16

* Fix typo in doc comment

* Bump tiny-keccak to version 1.4

* Remove unnecessary default-features = false in Cargo.toml
2018-10-01 09:58:11 +02:00
4fa680e282 Upgrade smallvec version to fix license issue (#526) 2018-09-30 16:18:19 +02:00
bf066773e3 ybsubscribing -> unsubscribing (#513) 2018-09-24 09:32:20 +02:00
ee9ff643a5 Split collection.rs in two (#507)
* Split collection.rs in two

* Fix forgot to interrupt inner task

* Another fix in collection.rs

* More qed
2018-09-21 17:31:52 +02:00
4fe92f81e8 Fix logic error in public key mismatch (#510) 2018-09-21 17:11:27 +02:00
b61d9faece multiaddr: future-proof error type (#506) 2018-09-21 10:39:36 +02:00
3f3d81cc95 Map AsyncWrite::shutdown to Sink::close. (#505) 2018-09-21 10:10:45 +02:00
a988926c3e Fix the ping dialer never closed (#504)
* Fix the ping dialer never closed

* Fix not ready
2018-09-21 10:06:04 +02:00
a910797f22 Fix invalid state after peer id mismatch (#503) 2018-09-21 09:32:23 +02:00
4d8da24c64 Fix the Default implementation of Ping (#501) 2018-09-20 19:53:31 +02:00
84b089cacc Refactor multiaddr crate. (#498)
Refactor multiaddr crate.

- Remove `AddrComponent`. Instead `Protocol` directly contains its
associated data.

- Various smaller changes around conversions to Multiaddr from other
types, e.g. socket addresses.

- Expand tests to include property tests which test encoding/decoding
identity.
2018-09-20 19:51:00 +02:00
1969bde4fe Rework the Ping protocol (#497)
* Rework the Ping upgrade

* Fix concerns
2018-09-20 16:55:57 +02:00
f2a5eee5e8 Add a NodeHandler trait (#495)
* Add a NodeHandler trait

* Fix compilation

* Some fixes
2018-09-19 16:33:29 +02:00
7fb09fbf20 secio: keep ciphertext if start_send is not ready (#494)
* secio: keep ciphertext if start_send is not ready

Otherwise ciphertext may be thrown away and once sent, the cipher states
have diverged, resulting in nonsense messages on decryption side.

* Also attempt to send pending data `Sink::close`.

* Inline `send_pending`.
2018-09-18 22:51:13 +02:00
8cf17f49e1 Add a basic test to listeners (#489) 2018-09-18 15:56:29 +02:00
783522f54c Prove the panics (#491) 2018-09-17 17:15:27 +02:00
0c43c76965 Implement close() from Sink (#492) 2018-09-17 15:01:37 +02:00
3e53a9dcc7 Fix additional addresses not tried (#483)
* Fix additional addresses not tried

* More fixes

* Produce a dialing error if unsupported multiaddr
2018-09-17 10:30:10 +02:00
d719ac6037 Revert "Revert "remove rustc-serialize (#359) (#386)" (#466)" (#477)
This reverts commit 0a3d4cdfad.
2018-09-17 10:05:37 +02:00