115 Commits

Author SHA1 Message Date
Roman Borschel
6ad05b0ff1
[libp2p-swarm] Ignore a node's own addresses on dialing. (#1646)
* Ignore a node's own addresses on dialing.

Dialing attempts of a local node to one of its own
addresses for what appears to be a different peer
ID are futile and bound to fail with an `InvalidPeerId`
error. To avoid such futile dialing attempts, filter
out the node's own addresses from the addresses
reported by the `NetworkBehaviour` for any peer.

There can be a few reasons why a `NetworkBehaviour` may
think an address belongs to a different peer, e.g.:

  1. In the context of e.g. `libp2p-kad`, the local node
     may have changed its network identity (e.g. key rotation)
     and "discovers" its former identity in the DHT, with the same
     address(es).
  2. Another peer may erroneously or intentionally, possibly even maliciously,
    report one of the local node's addresses as its own, making the node
    try to connect to itself.

Relates to https://github.com/paritytech/stakingops-issues/issues/18.

* Remove filtering of external addresses.

Since these are obtained from other peers, it would constitute
an attack vector. It is furthermore usually not possible for
a peer behind a NAT to dial its own external address so these
are unlikely to cause `InvalidPeerId` errors as a result of a
peer dialing itself under the expectation of one of its
former peer IDs.
2020-07-08 11:51:49 +02:00
Thomas Eizinger
c4a5497d2d
Allow users to opt out of the NetworkBehaviourEventProcess mechanism (#1630)
* Allow users to opt-out of the NetworkBehaviourEventProcess mechanism

* Add CHANGELOG entry

* Prepare release.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
Co-authored-by: Roman S. Borschel <roman@parity.io>
2020-07-08 11:32:47 +02:00
Roman Borschel
e9952ea9e3
Prepare releases. (#1640)
* Prepare releases.

* Re-export libp2p-request-response from libp2p crate.

* Clean up changelogs.

* Restore upper bounds.

* Version 0.21 for the root crate.

* Stricter lower bound in libp2p-websocket version in root crate.

* Update misc/peer-id-generator/Cargo.toml

Co-authored-by: Toralf Wittner <tw@dtex.org>

* Update release date.

* Update misc/peer-id-generator/Cargo.toml

Co-authored-by: Toralf Wittner <tw@dtex.org>

Co-authored-by: Toralf Wittner <tw@dtex.org>
2020-07-01 15:36:20 +02:00
Pierre Krieger
826f5130cd
Allow StreamMuxer to notify changes in the address (#1621)
* Allow StreamMuxer to notify changes in the address

* Fix doc link

* Revert accidental rename

* Other accidental rename

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-06-30 17:10:53 +02:00
Roman Borschel
eb8cb43508
Add libp2p-request-response protocol. (#1596)
* Add the libp2p-request-response protocol.

This crate provides a generic implementation for request/response
protocols, whereby each request is sent on a new substream.

* Fix OneShotHandler usage in floodsub.

* Custom ProtocolsHandler and multiple protocols.

  1. Implement a custom ProtocolsHandler instead of using
     the OneShotHandler for better control and error handling.
     In particular, all request/response sending/receiving is
     kept in the substreams upgrades and thus the background
     task of a connection.
  2. Support multiple protocols (usually protocol versions)
     with a single `RequestResponse` instance, with
     configurable inbound/outbound support.

* Small doc clarification.

* Remove unnecessary Sync bounds.

* Remove redundant Clone constraint.

* Update protocols/request-response/Cargo.toml

Co-authored-by: Toralf Wittner <tw@dtex.org>

* Update dev-dependencies.

* Update Cargo.tomls.

* Add changelog.

* Remove Sync bound from RequestResponseCodec::Protocol.

Apparently the compiler just needs some help with the scope
of borrows, which is unfortunate.

* Try async-trait.

* Allow checking whether a ResponseChannel is still open.

Also expand the commentary on `send_response` to indicate that
responses may be discard if they come in too late.

* Add `RequestResponse::is_pending`.

As an analogue of `ResponseChannel::is_open` for outbound requests.

* Revert now unnecessary changes to the OneShotHandler.

Since `libp2p-request-response` is no longer using it.

* Update CHANGELOG for libp2p-swarm.

Co-authored-by: Toralf Wittner <tw@dtex.org>
2020-06-29 17:08:40 +02:00
Toralf Wittner
0eef487ef8
Prepare release. (#1620) 2020-06-22 11:41:28 +02:00
Toralf Wittner
859aa59bd8
Avoid recursive dependencies due to tests. (#1609)
Remove `version` from workspace `dev-dependencies`.
2020-06-18 10:27:47 +02:00
Pierre Krieger
cacd7300de
Fix MultiHandler panicking when empty (#1598) 2020-06-05 11:48:53 +02:00
Pierre Krieger
34faf94538
Publish 0.19.0 (#1579) 2020-05-18 15:45:21 +02:00
Pierre Krieger
c271f6f56b
Make the number of events buffered to/from tasks configurable (#1574)
* Make the number of events buffered to/from tasks configurable

* Assign a PR number

* Fix comment

* Apply suggestions from code review

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>

* Rename variables

* Apply suggestions from code review

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-05-15 14:40:10 +02:00
Roman Borschel
5ba7c4831b
Permit concurrent dialing attempts per peer. (#1506)
* Permit concurrent dialing attempts per peer.

This is a follow-up to https://github.com/libp2p/rust-libp2p/pull/1440
and relates to https://github.com/libp2p/rust-libp2p/issues/925.
This change permits multiple dialing attempts per peer.
Note though that `libp2p-swarm` does not yet make use of this ability,
retaining the current behaviour. The essence of the changes are that the
`Peer` API now provides `Peer::dial()`, i.e. regardless of the state in
which the peer is. A dialing attempt is always made up of one or more
addresses tried sequentially, as before, but now there can be multiple
dialing attempts per peer. A configurable per-peer limit for outgoing
connections and thus concurrent dialing attempts is also included.

* Introduce `DialError` in `libp2p-swarm`.

For a cleaner API and to treat the case of no addresses
for a peer as an error, such that a `NetworkBehaviourAction::DialPeer`
request is always matched up with either `inject_connection_established`
or `inject_dial_error`.

* Fix rustdoc link.

* Add `DialPeerCondition::Always`.

* Adapt to master.

* Update changelog.
2020-05-12 13:10:18 +02:00
Pierre Krieger
87b5efb3e8
Make sure inject_dial_failure is called (#1549)
* Make sure inject_dial_failure is called

* Update CHANGELOG

* Make libp2p-kad tests pass

* Fix again

* Update swarm/src/lib.rs

Co-Authored-By: Toralf Wittner <tw@dtex.org>

* Revert "Fix again"

This reverts commit 80c0d3d908aff282d492f213d2ce34d12489167d.

* Bump versions and CHANGELOG

* Oops, didn't bump libp2p-swarm in libp2p

Co-authored-by: Toralf Wittner <tw@dtex.org>
2020-04-17 18:13:16 +02:00
Pierre Krieger
aa71158e5c
Publish 0.18.0 (#1547) 2020-04-09 16:54:01 +02:00
Pierre Krieger
3ae02a56a5
Bump to 0.17.0 (#1537) 2020-04-01 19:53:34 +02:00
Roman Borschel
6af530d6b2
Re-export OneShotHandlerConfig. Make fields public. (#1538)
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-04-01 17:37:27 +02:00
Tobin Harding
b1059cd801
Pass the error to inject_listener_closed method (#1517)
* Pass the error to inject_listener_closed method

If there is an error when the listener closes, found in the
`NetworkEvent::ListenerClosed` `reason` field, we would like to pass it
on to the `inject_listener_closed()` method so that implementors of this
method have access to it.

Add an error parameter to `inject_listener_closed`.  Convert the
`reason` field from a `Result` to an `Option` and if there is an error
pass `Some(error)` at the method call site.

* Pass 'reason' as a Result

* Finish change

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-04-01 14:49:42 +02:00
Piotr Gołąb
6b4bdc1fe9
Allow configuration of outbound substream in OneShotHandler. (#1521)
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-04-01 13:07:10 +02:00
Roman Borschel
be970466b3
Full support for multiple connections per peer in libp2p-swarm. (#1519)
* [libp2p-swarm] Make the multiple connections per peer first-class.

This commit makes the notion of multiple connections per peer
first-class in the API of libp2p-swarm, introducing the new
callbacks `inject_connection_established` and
`inject_connection_closed`. The `endpoint` parameter from
`inject_connected` and `inject_disconnected` is removed,
since the first connection to open may not be the last
connection to close, i.e. it cannot be guaranteed,
as was previously the case, that the endpoints passed
to these callbacks match up.

* Have identify track all addresses.

So that identify requests can be answered with the correct
observed address of the connection on which the request
arrives.

* Cleanup

* Cleanup

* Improve the `Peer` state API.

* Remove connection ID from `SwarmEvent::Dialing`.

* Mark `DialPeerCondition` non-exhaustive.

* Re-encapsulate `NetworkConfig`.

To retain the possibility of not re-exposing all
network configuration choices, thereby providing
a more convenient API on the \`SwarmBuilder\`.

* Rework Swarm::dial API.

* Update CHANGELOG.

* Doc formatting tweaks.
2020-03-31 15:41:13 +02:00
Toralf Wittner
0d3e4f2051
Add protocols_handler::multi module. (#1497)
* Add `protocols_handler::multi` module.

An implementation of `ProtocolsHandler` that contains multiple other
`ProtocolsHandler`s indexed by some key type.

* Randomise start position of handler polling.

* Address some review concerns.

* Add `IntoMultiHandler`.

* Check protocol names for uniqueness.

* Changes due to review.

- No more `Debug` bound for the key type and more generic log messages.
- Additional comments.
- Imports instead of fully-qualified use.
- Renamed `DuplicateProtoname` to `DuplicateProtonameError`.

* Replace `HashMap` with `Vec` in `Upgrades`.

* Review suggestion.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-03-26 18:25:17 +01:00
Pierre Krieger
7220877a5c
Make the SwarmEvent report everything (#1515)
* Improve the SwarmEvent to report everything

* Address review

* Update swarm/src/lib.rs

Co-Authored-By: Roman Borschel <romanb@users.noreply.github.com>

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-03-26 18:02:37 +01:00
Roman Borschel
28ea62d1a9
[libp2p-swarm] Correct returned connections from notify_all. (#1513)
* [libp2p-swarm] Correct returned connections from notify_all.

If at least one connection was not ready (i.e. pending), only
those (pending) connections would be returned and considered on the next
iteration, whereas those which were ready should also remain
in the list of connections to notify on retry of `notify_all`.

* Simplify.

It seems unnecessary to use "poll all" -> "send all" semantics,
i.e. attempting an "atomic" broadcast. Rather, events send via
`notify_all` can be delivered as soon as possible, simplifying
the code further.
2020-03-25 13:53:03 +01:00
Tobin Harding
7bf5266a02
Add addresses field for closing listeners (#1485)
* Add addresses field for closing listeners

Add an addresses field to the ListenersEvent and the ListenerClosed to
hold the addresses of a listener that has just closed. When we return a
ListenerClosed network event loop over the addresses and call
inject_expired_listen_address on each one.

Fixes: #1482

* Use Vec instead of SmallVec

In order to not expose a third party dependency in our API use a `Vec`
type for the addresses list instead of a `SmallVec`.

* Do not clone for ListenersEvent::Closed

We would like to avoid clones where possible for efficiency reasons.
When returning a `ListenersEvent::Closed` we are already consuming the
listener (by way of a pin projection).  We can therefore use a consuming
iterator instead of cloning.

Use `drain(..).collect()` instead of clone to consume the addresses when
returning a `ListenersEvent::Closed`.

* Expire addresses before listener

The listener and its addresses technically expire at the same time, but
since here we have to pick an order, it makes more sense that the
addresses expire first.

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-03-23 11:31:38 +01:00
Roman Borschel
58ee13b630
Fix regression w.r.t. reporting of dial errors. (#1493)
* Fix regression w.r.t. reporting of dial errors.

PR [1440] introduced a regression w.r.t. the reporting of
dial errors. In particular, if a connection attempt fails
due to an invalid remote peer ID, any remaining addresses
for the same peer would not be tried (intentional) but
the dial failure would not be reported to the behaviour,
causing e.g. libp2p-kad queries to potentially stall.

In hindsight, I figured it is better to preserve the
previous behaviour to still try alternative addresses
of the peer even on invalid peer ID errors on an earlier
address. In particular because in the context of libp2p-kad
it is not uncommon for peers to report localhost addresses
while the local node actually has e.g. an ipfs node running
on that address, obviously with a different peer ID, which
is the scenario causing frequent invalid peer ID (mismatch)
errors when running the ipfs-kad example.

This commit thus restores the previous behaviour w.r.t.
trying all remaining addresses on invalid peer ID errors
as well as making sure `inject_dial_error` is always
called when the last attempt failed.

[1440]: https://github.com/libp2p/rust-libp2p/pull/1440.

* Remove an fmt::Debug requirement.
2020-03-16 16:53:21 +01:00
Roman Borschel
8337687b3a
Multiple connections per peer (#1440)
* Allow multiple connections per peer in libp2p-core.

Instead of trying to enforce a single connection per peer,
which involves quite a bit of additional complexity e.g.
to prioritise simultaneously opened connections and can
have other undesirable consequences [1], we now
make multiple connections per peer a feature.

The gist of these changes is as follows:

The concept of a "node" with an implicit 1-1 correspondence
to a connection has been replaced with the "first-class"
concept of a "connection". The code from `src/nodes` has moved
(with varying degrees of modification) to `src/connection`.
A `HandledNode` has become a `Connection`, a `NodeHandler` a
`ConnectionHandler`, the `CollectionStream` was the basis for
the new `connection::Pool`, and so forth.

Conceptually, a `Network` contains a `connection::Pool` which
in turn internally employs the `connection::Manager` for
handling the background `connection::manager::Task`s, one
per connection, as before. These are all considered implementation
details. On the public API, `Peer`s are managed as before through
the `Network`, except now the API has changed with the shift of focus
to (potentially multiple) connections per peer. The `NetworkEvent`s have
accordingly also undergone changes.

The Swarm APIs remain largely unchanged, except for the fact that
`inject_replaced` is no longer called. It may now practically happen
that multiple `ProtocolsHandler`s are associated with a single
`NetworkBehaviour`, one per connection. If implementations of
`NetworkBehaviour` rely somehow on communicating with exactly
one `ProtocolsHandler`, this may cause issues, but it is unlikely.

[1]: https://github.com/paritytech/substrate/issues/4272

* Fix intra-rustdoc links.

* Update core/src/connection/pool.rs

Co-Authored-By: Max Inden <mail@max-inden.de>

* Address some review feedback and fix doc links.

* Allow responses to be sent on the same connection.

* Remove unnecessary remainders of inject_replaced.

* Update swarm/src/behaviour.rs

Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update swarm/src/lib.rs

Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update core/src/connection/manager.rs

Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update core/src/connection/manager.rs

Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update core/src/connection/pool.rs

Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>

* Incorporate more review feedback.

* Move module declaration below imports.

* Update core/src/connection/manager.rs

Co-Authored-By: Toralf Wittner <tw@dtex.org>

* Update core/src/connection/manager.rs

Co-Authored-By: Toralf Wittner <tw@dtex.org>

* Simplify as per review.

* Fix rustoc link.

* Add try_notify_handler and simplify.

* Relocate DialingConnection and DialingAttempt.

For better visibility constraints.

* Small cleanup.

* Small cleanup. More robust EstablishedConnectionIter.

* Clarify semantics of `DialingPeer::connect`.

* Don't call inject_disconnected on InvalidPeerId.

To preserve the previous behavior and ensure calls to
`inject_disconnected` are always paired with calls to
`inject_connected`.

* Provide public ConnectionId constructor.

Mainly needed for testing purposes, e.g. in substrate.

* Move the established connection limit check to the right place.

* Clean up connection error handling.

Separate connection errors into those occuring during
connection setup or upon rejecting a newly established
connection (the `PendingConnectionError`) and those
errors occurring on previously established connections,
i.e. for which a `ConnectionEstablished` event has
been emitted by the connection pool earlier.

* Revert change in log level and clarify an invariant.

* Remove inject_replaced entirely.

* Allow notifying all connection handlers.

Thereby simplify by introducing a new enum `NotifyHandler`,
used with a single constructor `NetworkBehaviourAction::NotifyHandler`.

* Finishing touches.

Small API simplifications and code deduplication.
Some more useful debug logging.

Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Toralf Wittner <tw@dtex.org>
2020-03-04 13:49:25 +01:00
Pierre Krieger
fa4cd50476
Publish 0.16.1 (#1459) 2020-02-18 14:05:22 +01:00
Rüdiger Klaehn
145200fa4f
Implement FusedStream for Swarm (#1433)
* Implement FusedStream for Swarm

The stream for swarm will never terminate, and therefore does not have to
keep track of termination.

* Get rid of the wall of complex type constraints

...as they don't seem to be necessary anymore for latest master
2020-02-18 10:33:01 +01:00
Pierre Krieger
ace8123cf2
Publish 0.16.0 (#1453)
* Publish 0.16.0

* Apply suggestions from code review

Co-Authored-By: Toralf Wittner <tw@dtex.org>

Co-authored-by: Toralf Wittner <tw@dtex.org>
2020-02-14 11:33:52 +01:00
Pierre Krieger
fc4dec581e
Check documentation intra-link (#1432)
* Fix broken links in rustdoc

This fixes all of the rustdoc warnings on nightly.

* Check documentation intra-link

* Fix config

* Fix bad indent

* Make nightly explicit

* More links fixes

* Fix link broken after master merge

Co-authored-by: Demi Obenour <48690212+DemiMarie-parity@users.noreply.github.com>
2020-02-10 15:17:07 +01:00
Pierre Krieger
1eff4b9823
Simplify trait bounds on NetworkBehaviour (#1405)
* Simplify trait bounds requirements

* More work

* Moar

* Finish

* Fix final tests

* More simplification

* Use separate traits for Inbound/Outbound

* Update gossipsub and remove warnings

* Add documentation to swarm

* Remove BoxSubstream

* Fix tests not compiling

* Fix stack overflow

* Address concerns

* For some reason my IDE ignored libp2p-kad
2020-02-07 16:29:30 +01:00
Pierre Krieger
4bf42d188f
Remove all mod.rs files (#1400) 2020-01-28 08:51:06 +01:00
Pierre Krieger
f1f40956d6
Publish 0.15.0 (#1408)
* Publish 0.15.0

* Oops, script too efficient
2020-01-24 17:14:56 +01:00
Pierre Krieger
7d0c80fce1
Executor + Send (#1399) 2020-01-20 15:22:47 +01:00
Pierre Krieger
f89683419a
Allow configuring the tasks executor (#1391)
* Allow configuring the tasks executor

* Minor tweaks

* Add executor_fn

* Create ThreadsPool at the end if necessary

* Allow configuring the tasks executor

* Minor tweaks

* Add executor_fn

* Create ThreadsPool at the end if necessary

* WIP

* Don't depend on async-std and tokio in core

* Replace FutureObj with PinBoxFuture

* Some docs on Executor

* Fix tests

Co-authored-by: Toralf Wittner <tw@dtex.org>
2020-01-20 14:18:35 +01:00
Roman Borschel
c241014ddb
Log connection close in swarm. Simplify bounds. (#1393) 2020-01-16 13:17:39 +01:00
Joonas Koivunen
7df3e74d79 Enhance NetworkBehaviour docs (#1362)
* add docs about deriving NetworkBehaviour

* add commentary to the chat example

also minor stuff like reordering to match the struct elements, note why the listening address is
reported in poll.

* fix remove the warning on the example ignored field

* Apply suggestions from code review

Thanks for suggestions!

Co-Authored-By: Max Inden <mail@max-inden.de>

* chore cleanup added docs after suggestions

* fix print all listening addresses in examples/chat

not that there should be more than one but it makes sense to repeat the full example here.

* chore remove confusing writing on printing the listening addrs

* fix use intra-docs, spelling

Co-Authored-By: Roman S. Borschel <roman@parity.io>

Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-01-14 12:48:16 +01:00
Pierre Krieger
3f968cbf92
Remove some Unpin requirements on Futures (#1384)
* Remove lots of Unpin requirements

* Make Transport::and_then accept pinned futures

* Finish the PR

* Work on secio

* Fix BandwidthTransport

* Adjust ListenersStrema

* Fix nodes/tasks

* Fix nodes

* Various more fixes

* Fix yamux

* Fix Swarm

* Fix WebSockets

* Fix rw-stream-sink
2020-01-14 12:03:10 +01:00
Pierre Krieger
42a45e2630
Remove Negotiated from upgrade traits (#1388)
* Remove Negotiated from upgrade traits

* Remove import
2020-01-13 14:34:43 +01:00
Pierre Krieger
84487cf904
Publish 0.14.0-alpha.1 (#1376)
* Publish 0.14.0-alpha.1

* multiaddr -> 0.7.0
2020-01-07 15:30:39 +01:00
Pierre Krieger
84b6a7d04d
Add Swarm::next_extended (#1374)
* Add Swarm::next_extended

* Fix ipfs-kad example

* Fix tests

* Renames
2020-01-07 11:57:00 +01:00
Pierre Krieger
90e0044dd6
Apply suggestions from code review
Co-Authored-By: Max Inden <mail@max-inden.de>
2020-01-03 11:58:08 +01:00
Toralf Wittner
02c5f34fc0
Update more crates to futures-0.3 (#1312) 2019-11-19 11:18:16 +01:00
Toralf Wittner
f85241dd36 Update core, tcp, secio and mplex to futures-0.3. (#1302)
* Update `rw-stream-sink` to futures-0.3.

* Update core, tcp, secio and mplex to futures-0.3.

On top of https://github.com/libp2p/rust-libp2p/pull/1301
2019-11-14 13:42:14 +01:00
Pierre Krieger
c1226b203a
Cherry-pick commits from master to stable-futures (#1296)
* Implement Debug for (ed25519|secp256k1)::(Keypair|SecretKey) (#1285)

* Fix possible arithmetic overflow in libp2p-kad. (#1291)

When the number of active queries exceeds the (internal)
JOBS_MAX_QUERIES limit, which is only supposed to bound
the number of concurrent queries relating to background
jobs, an arithmetic overflow occurs. This is fixed by
using saturating subtraction.

* protocols/plaintext: Add example on how to upgrade with PlainTextConfig1 (#1286)

* [mdns] - Support for long mDNS names (Bug #1232) (#1287)

* Dead code -- commenting out with a note referencing future implementation

* Adding "std" feature so that cargo can build in other directories (notably `misc/mdns`, so that I could run these tests)

* Permitting `PeerID` to be built from an `Identity` multihash

* The length limit for DNS labels is 63 characters, as per RFC1035

* Allocates the vector with capacity for the service name plus additional QNAME encoding bytes

* Added support for encoding/decoding peer IDs with an encoded length greater than 63 characters

* Removing "std" from ring features

Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>

* Retaining MAX_INLINE_KEY_LENGTH with comment about future usage

* `segment_peer_id` consumes `peer_id` ... plus an early return for IDs that don't need to be segmented

* Fixing logic

* Bump most dependencies (#1268)

* Bump most dependencies

This actually builds 😊.

* Bump all dependencies

Includes the excellent work of @rschulman in #1265.

* Remove use of ed25519-dalek fork

* Monomorphize more dependencies

* Add compatibility hack for rand

Cargo allows a crate to depend on multiple versions of another, but
`cargo-web` panics in that situation.  Use a wrapper crate to work
around the panic.

* Use @tomaka’s idea for using a newer `rand`

instead of my own ugly hack.

* Switch to Parity master

as its dependency-bumping PR has been merged.

* Update some depenendencies again

* Remove unwraps and `#[allow(deprecated)]`.

* Remove spurious changes to dependencies

Bumping minor or patch versions is not needed, and increases likelyhood
of merge conflicts.

* Remove some redundant Cargo.toml changes

* Replace a retry loop with an expect

`ed25519::SecretKey::from_bytes` will never fail for 32-byte inputs.

* Revert changes that don’t belong in this PR

* Remove using void to bypass ICE (#1295)

* Publish 0.13.0 (#1294)
2019-11-06 16:09:15 +01:00
Pierre Krieger
abe2f2afc1
Merge master into stable-futures (#1271)
* Configurable multistream-select protocol. Add V1Lazy variant. (#1245)

Make the multistream-select protocol (version) configurable
on transport upgrades as well as for individual substreams.

Add a "lazy" variant of multistream-select 1.0 that delays
sending of negotiation protocol frames as much as possible
but is only safe to use under additional assumptions that
go beyond what is required by the multistream-select v1
specification.

* Improve the code readability of the chat example (#1253)

* Add bridged chats (#1252)

* Try fix CI (#1261)

* Print Rust version on CI

* Don't print where not appropriate

* Change caching strategy

* Remove win32 build

* Remove win32 from list

* Update libsecp256k1 dep to 0.3.0 (#1258)

* Update libsecp256k1 dep to 0.3.0

* Sign now cannot fail

* Upgrade url and percent-encoding deps to 2.1.0 (#1267)

* Upgrade percent-encoding dep to 2.1.0

* Upgrade url dep to 2.1.0

* Fix more conflicts

* Revert CIPHERS set to null (#1273)
2019-10-10 11:31:44 +02:00
Toralf Wittner
67642eb691 Update to futures-preview-0.3.0-alpha.18. (#1255) 2019-09-24 18:54:53 +02:00
Pierre Krieger
c7148d5ee5
Address some reviewing (#1246) 2019-09-20 10:46:13 +02:00
Pierre Krieger
170d2d268f
Switch to stable futures (#1196)
* Switch to stable futures

* Remove from_fn

* Fix secio

* Fix core --lib tests
2019-09-16 11:08:44 +02:00
Pierre Krieger
181af7175f
Publish v0.12.0 (#1224) 2019-08-15 13:50:28 +02:00
Toralf Wittner
2c4b52a545 Return TCP listener errors. (#1218)
* Add listener ID and error event.

Report listener errors to client code so they are aware that an error
occurred within a listener. By default we continue to poll listeners
which produced an error, but clients can remove listeners by ID.

* tcp: Report errors.

Instead of silently waiting after errors we return all errors, but pause
after each error, before continuing.

* Add a test.

To ease testing, `Listener` is made generic and we test that no values
and errors are lost. Elapsed time between item generation is not
measured.

* Support the new methods in core-derive.

* Address review concerns.

* Remove `Display` impl of `ListenerId`.

* Add 'static bound to `on_listener_error` error.
2019-08-13 15:41:12 +02:00
Jens Krause
757e800117 Add is_enabled() for Toggle (#1216) 2019-08-03 18:00:27 +02:00