1345 Commits

Author SHA1 Message Date
Roman S. Borschel
12e50b13d0 Update top-level libp2p-websocket patch version. 2020-12-07 12:47:52 +01:00
Roman S. Borschel
226e1058e1 Prepare libp2p-websocket-0.26.1 2020-12-07 12:41:52 +01:00
dependabot[bot]
e41a963649
Update rustls requirement from 0.18.0 to 0.19.0 (#1852)
Updates the requirements on [rustls](https://github.com/ctz/rustls) to permit the latest version.
- [Release notes](https://github.com/ctz/rustls/releases)
- [Changelog](https://github.com/ctz/rustls/blob/main/OLDCHANGES.md)
- [Commits](https://github.com/ctz/rustls/compare/v/0.18.0...v/0.19.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-07 12:37:25 +01:00
David Craven
505a17dfc2
Adds support for handling interface changes to mdns behaviour. (#1830)
* mdns: handle address changes.

* Update examples.

* Use async-io.

* Fix tokio-chat.

* Address review comments.

* Update if-watch.

* Poll interfaces correctly.

* Use socket2 and remove wasm-time.

* Update if-watch.

* Update versions and changelogs.

* Further changelog updates.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
Co-authored-by: Roman S. Borschel <roman@parity.io>
2020-12-03 13:30:52 +01:00
Roman S. Borschel
4bdb61be0d Prepare multistream-select-0.9.1 2020-12-02 16:41:59 +01:00
Roman Borschel
86402311fc
[multistream-select] Listener conformity for failed negotiations. (#1871)
* [multistream-select] Listener conformity for failed negotiations.

When `V1Lazy` is used and the listener does not support the
optimistic (and singular) proposal of the dialer, it currently
happens that dialer and listener get a different outcome of
the negotiation. The dialer eventually detects the failed
negotiation as soon as it tries to read from the stream, but
the listener either encounters an invalid message or unexpected
premature EOF, depending on the payload that the dialer sent
prematurely after its protocol proposal. In these cases the
listener must be lenient and fail the negotiation "normally",
i.e. not with a protocol violation or an I/O error.

* Update misc/multistream-select/src/tests.rs

Co-authored-by: Max Inden <mail@max-inden.de>

* Refine error handling.

Only be lenient with garbage or sudden EOF when reading
just after having sent a protocol rejection.

* Update misc/multistream-select/src/listener_select.rs

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>
2020-12-02 16:40:58 +01:00
Roman Borschel
2cd2e6d654
Address some minor clippy warnings. (#1868) 2020-11-30 16:45:40 +01:00
Max Inden
afc5d0ef82
.github/workflow: Don't require nightly for doc link check (#1866)
The `broken_intra_doc_links` lint stabilized with Rust `v1.48`, thus the
special usage of `nightly` is not needed anymore in the pipeline step.
2020-11-30 11:11:20 +01:00
Max Inden
dae07b075b
swarm: Add ExpandedSwarm::is_connected (#1862)
Commit 335e55e6 removed the `ConnectionInfo` trait in favor of
`PeerId`s. Commit 1bd013c8 removed `ExpandedSwarm::connection_info` as
it would only return the `PeerId` that the caller is already aware of.

One could use `ExpandedSwarm::connection_info` not only to retrieve the
`ConnectionInfo` for a given peer, but also to check whether the
underlying `Network` has a connection to the peer.

This commit exposes the `is_connected` method on `Network` via
`ExpandedSwarm` to check whether the `Network` has an established
connection to a given peer.
2020-11-26 21:01:38 +01:00
Roman S. Borschel
d3ce35291b Correct async-std bound for tcp. 2020-11-26 10:42:33 +01:00
Roman S. Borschel
5e5c3226d8 Prepare core-0.25.1 and multiaddr-0.10. 2020-11-25 16:51:07 +01:00
Roman S. Borschel
6f7acc0f41 Add missing multiaddr update.
As a result of the multihash upgrade.
2020-11-25 16:42:39 +01:00
Roman Borschel
bc102bc923
Prepare release of libp2p-v0.31 and all unreleased sub-crates. (#1857)
* Prepare v0.31

* Update core-derive

* Update minimum multiaddr patch version in libp2p crate.
2020-11-25 15:30:13 +01:00
Roman Borschel
83e87f76c0
[swarm] Permit configuration override for the substream upgrade protocol to use. (#1858)
* Permit global configuration of a substream upgrade protocol override.

* Revert temporary test.

* Revert temporary test.

* Update swarm changelog.
2020-11-25 14:26:49 +01:00
Roman Borschel
65c4bf88dc
[multistream] Make the lazy variant more interoperable. (#1855)
* Make the lazy variant interoperable.

The remaining optimisation for `V1Lazy` for a listener
in the negotiation, whereby the listener delays flushing
of the multistream version header, is hereby removed.
The remaining effect of `V1Lazy` is only on the side of
the dialer, which delays flushing of its singular
protocol proposal in order to send it together with
the first application data (or an attempt is made to
read from the negotiated stream, which similarly
triggers a flush of the protocol proposal). This
permits `V1Lazy` dialers to be interoperable with
`V1` listeners. The remaining theoretical pitfall whereby
application data gets misinterpreted as another protocol
proposal by a listener remains, however unlikely.

`V1` remains the default, but we may eventually risk
just making this lazy dialer flush a part of the default
`V1` implementation, removing the dedicated `V1Lazy`
version identifier.

* Update CHANGELOG

* Separate versions from mere header lines.

Every multistream-select version maps to a specific header line,
but there may be different variants of the same multistream-select
version using the same header line, i.e. the same wire protocol.

* Cleanup

* Update misc/multistream-select/CHANGELOG.md
2020-11-25 10:21:02 +01:00
dependabot[bot]
c01ac52745
Update webpki-roots requirement from 0.20 to 0.21 (#1851)
* Update webpki-roots requirement from 0.20 to 0.21

Updates the requirements on [webpki-roots](https://github.com/ctz/webpki-roots) to permit the latest version.
- [Release notes](https://github.com/ctz/webpki-roots/releases)
- [Commits](https://github.com/ctz/webpki-roots/compare/v/0.20.0...v/0.21.0)

Signed-off-by: dependabot[bot] <support@github.com>

* transports/websocket: Update changelog

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-11-24 19:08:44 +01:00
Roman S. Borschel
86d2281222 Tweak docs of StreamMuxer::poll_event 2020-11-24 17:36:44 +01:00
Max Inden
e3af8b7d03
*: Apply clippy suggestions and enable clippy on CI (#1850)
* *: Apply clippy suggestions

* .github: Add clippy check

* protocols/kad/record: Implement custom PartialEq for ProviderRecord
2020-11-24 15:59:22 +01:00
Pierre Krieger
5e21806a38
Some petty changes head of QUIC (#1854) 2020-11-24 12:40:11 +01:00
Roman Borschel
cef75ab7e1
[core/swarm] Refactor and extend configurable connection limits. (#1848)
* Refactor and extend configurable connection limits.

To better track different connection counts, permit configurable
limits for these counts and make these available for
inspection efficiently, introduce dedicated connection counters
via a `ConnectionCounters` structure that is exposed on the
API via the `NetworkInfo`. All connection or connection
states that are counted in this way can also have effective
configurable limits.

* Cleanup

* Add missing file.

* Refine naming and config API.

* Update core/CHANGELOG.md

Co-authored-by: Max Inden <mail@max-inden.de>

* Update core/CHANGELOG.md

Co-authored-by: Max Inden <mail@max-inden.de>

Co-authored-by: Max Inden <mail@max-inden.de>
2020-11-23 17:22:15 +01:00
Roman Borschel
1bd013c843
[swarm] Configurable and "infinite" scores for external addresses. (#1842)
* Add "infinite" scores for external addresses.

Extend address scores with an infinite cardinal, permitting
addresses to be retained "forever" or until explicitly removed.

Expose (external) address scores on the API.

* Update swarm/src/registry.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix compilation.

* Update CHANGELOG

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-11-18 15:52:33 +01:00
Roman Borschel
edb99eded6
[multistream-select] Fix ls response encoding/decoding (spec-compliance). (#1811)
* Fix ls response encoding/decoding.

Thereby remove the now unnecessary arbitrary protocol name
length limit. Since it an 'ls' response is always terminated
with a dedicated newline (and thus ends with two newlines),
an 'ls' response with a single protocol can be disambiguated
from a single protocol response by this additional newline.

* More commentary

* Update versions and changelogs.

* Resolve remaining conflict.

* Permit empty ls responses, as before.
2020-11-18 12:03:07 +01:00
dependabot[bot]
5e2ad029ca
Bump styfle/cancel-workflow-action from 0.4.1 to 0.6.0 (#1846)
Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.4.1 to 0.6.0.
- [Release notes](https://github.com/styfle/cancel-workflow-action/releases)
- [Commits](https://github.com/styfle/cancel-workflow-action/compare/0.4.1...ce177499ccf9fd2aded3b0426c97e5434c2e8a73)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-17 15:42:43 +01:00
Denis Pisarev
6477d04e29
Update CI (#1837)
* fix (CI): upda dependabotchecks and actions versions

* fix (CI): readability

* change (CI): interrupt prev run on the subsequent commit, simplify caching

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
2020-11-17 15:20:38 +01:00
Volker Mische
3f38c1c8bb
feat: upgrade multihash (#1792)
* feat: upgrade to multihash 0.13

`multihash` changes a lot internally, it is using stack allocation instead
of heap allocation. This leads to a few limitations in regards on how
`Multihash` can be used.

Therefore `PeerId` is now using a `Bytes` internally so that only minimal
changes are needed.

* Update versions and changelogs.

Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
Co-authored-by: Roman S. Borschel <roman@parity.io>
2020-11-17 11:15:20 +01:00
Roman S. Borschel
650812abc3 Prepare parity-multiaddr-0.9.6 2020-11-17 10:39:11 +01:00
Roman S. Borschel
4876ac0d7e Update multiaddr CHANGELOG. 2020-11-17 10:32:51 +01:00
Mikhail Zabaluev
fe6e622f3b
multiaddr: feature gate url dependency (#1843)
* multiaddr: feature gate url dependency

Make it possible to exclude url and its dependencies
from the dependency tree, by feature gating the
from_url* functions in the public API.

* Document feature gating of multiaddr::from_url*
2020-11-17 10:31:04 +01:00
Roman Borschel
41d3f72f0e
[mplex] Add benchmark, tweak default split_send_size. (#1834)
* [mplex]  Benchmark different split_send_size configurations.

With both TCP and memory transports. As a result, change the
default `split_send_size` to 8KiB.

* Cleanup

* [mplex] Update CHANGELOG.

* Add throughput information.
2020-11-16 17:41:00 +01:00
Max Inden
6f1edb0e6a
misc/multiaddr: Prepare v0.9.5 release 2020-11-14 20:40:36 +01:00
Max Inden
2e6b0ec1fa
misc/multiaddr: Increase patch version and update changelog 2020-11-14 18:12:52 +01:00
Pawan Dhananjay
f7ab4f7869
misc/multiaddr: Limit initial memory allocation in visit_seq (#1833)
Without a limit, one can send malformed input such that seq.size_hint() returns
a very large value and crashes the program even if the following data is pretty
small.
2020-11-14 18:08:49 +01:00
Roman S. Borschel
9c74b40870 Prepare 0.30.1 2020-11-11 14:11:17 +01:00
Roman Borschel
f771bcc35f
[plaintext] Retain remaining read buffer after handshake. (#1831)
* Retain remaining read buffer.

When the plaintext protocol handshake finishes and
the `Framed` I/O is discarded in favour of the underlying
I/O stream, the remaining read buffer of `Framed` must
be retained, as it may have buffered data beyond the
end of the handshake.

* Update versions and changelogs.
2020-11-11 14:09:33 +01:00
Max Inden
fabb00c21b
*: Bump changelogs and cargo tomls for parity-multiaddr 2020-11-09 17:56:54 +01:00
Max Inden
5f8a003bcd
*: Update changelogs to release v0.30.0 (#1829)
* *: Update changelogs to release v0.30.0

* muxers/mplex/CHANGELOG: Reference pull request

* misc/multistream-select/CHANGELOG: Update date
2020-11-09 17:46:07 +01:00
Max Inden
70bb2d7c11
misc/multistream-select: Interpretation of EOF as Failed negotiation (#1823)
Treat EOF error as [`NegotiationError::Failed`], not as
[`NegotiationError::ProtocolError`], allowing dropping or closing an I/O stream
as a permissible way to "gracefully" fail a negotiation.

This is e.g. important when a listener rejects a protocol with
[`Message::NotAvailable`] and the dialer does not have alternative protocols to
propose. Then the dialer will stop the negotiation and drop the corresponding
stream. As a listener this EOF should be interpreted as a failed negotiation.
2020-11-09 16:04:00 +01:00
Roman Borschel
3859116bca
[mplex] Tweak default config and yield before exceeding buffer limits. (#1825)
* [mplex] Tweak default config and yield before exceeding buffer limits.

* Update CHANGELOG
2020-11-09 15:25:03 +01:00
dependabot[bot]
cc588ec592
Update bs58 requirement from 0.3.0 to 0.4.0 (#1827)
Updates the requirements on [bs58](https://github.com/mycorrhiza/bs58-rs) to permit the latest version.
- [Release notes](https://github.com/mycorrhiza/bs58-rs/releases)
- [Commits](https://github.com/mycorrhiza/bs58-rs/compare/0.3.0...0.4.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-09 14:49:25 +01:00
Max Inden
c48cacfcf5
*/Cargo.toml: Update multihash (#1828) 2020-11-09 14:31:51 +01:00
Pierre Krieger
b482833c3c
Fix the multiaddr parsing in the JS snippet (#1824)
* Fix the multiaddr parsing in the JS snippet

* Update CHANGELOG
2020-11-06 09:46:47 +01:00
Roman Borschel
2ba78b4ce7
[mplex, yamux] Streamline configuration API. (#1822)
* Streamline mplex and yamux configurations.

  * For all configuration options that exist for both multiplexers
    and have the same semantics, use the same names for the
    configuration.
  * Rename `Config` to `YamuxConfig` for consistentcy with
    the majority of other protocols, e.g. `MplexConfig`, `PingConfig`,
    `KademliaConfig`, etc.
  * Completely hide `yamux` APIs within `libp2p-yamux`. This allows
    to fully control the libp2p API and streamline it with other
    muxer APIs, consciously choosing e.g. which configuration options
    to make configurable in libp2p and which to fix to certain values.
    It does also not necessarily prescribe new incompatible version bumps of
    yamux for `libp2p-yamux`, as no `yamux` types are exposed. The cost
    is some more duplication of configuration options in the API, as well
    as the need to update `libp2p-yamux` if `yamux` introduces new
    configuration options that `libp2p-yamux` wants to expose as well.

* Update CHANGELOGs.
2020-11-06 09:46:22 +01:00
Roman Borschel
689eeaf533
[kad] Update local routing table on new connections after protocol confirmation. (#1821)
* Delay routing table update on new connections.

In order to avoid adding peers to the local routing table
which use a different protocol name and thus a different
overlay network, only update the local routing table
for newly established connections once the associated
connection handler reports that the protocol has been
confirmed.

* Update CHANGELOG.
2020-11-05 20:58:14 +01:00
dependabot[bot]
c812b8d56c
Update tokio requirement from 0.2 to 0.3 (#1796)
* Update tokio requirement from 0.2 to 0.3

Updates the requirements on [tokio](https://github.com/tokio-rs/tokio) to permit the latest version.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-0.2.0...tokio-0.3.0)

Signed-off-by: dependabot[bot] <support@github.com>

* protocols/mdns: Ensure to set non_blocking on tokio udp socket

* transports/tcp: Ensure to set non_blocking on tokio tcp socket

See https://github.com/tokio-rs/tokio/pull/3016 for details.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2020-11-03 14:09:10 +01:00
dependabot[bot]
8f53ec61fd
Update minicbor requirement from 0.6 to 0.7 (#1819)
Updates the requirements on [minicbor](https://gitlab.com/twittner/minicbor) to permit the latest version.
- [Release notes](https://gitlab.com/twittner/minicbor/tags)
- [Commits](https://gitlab.com/twittner/minicbor/compare/minicbor-v0.6.0...minicbor-v0.7.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-02 09:27:11 +01:00
Thomas Eizinger
335e55e60d
Remove ConnectionInfo trait (#1813)
In all cases, we pass the PeerId directly as the connection info.
The flexbility of doing something different here was originally
envisioned but turned out to be never needed.

For reference see: https://github.com/libp2p/rust-libp2p/issues/1798#issuecomment-714526056

Co-authored-by: Max Inden <mail@max-inden.de>
2020-10-30 15:51:27 +01:00
Roman Borschel
421ae9d9c9
Be lenient with duplicate Close frames. (#1816) 2020-10-28 16:33:48 +01:00
Roman Borschel
bc11739b41
[mplex] Test all substreams closing on error. (#1812) 2020-10-22 18:26:10 +02:00
Max Inden
91d7db46a3
Prepare v0.29.1 (#1809)
* *: Update date in changelogs

* core/Cargo.toml: Bump multistream-select to v0.8.4
2020-10-20 17:42:10 +02:00
Max Inden
177567b177
core/Cargo.toml: Update to ed25519-dalek v1.0.1 (#1808) 2020-10-20 17:03:10 +02:00