19 Commits

Author SHA1 Message Date
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
Demi Obenour
9178459cc8
Automatic fixes by cargo-fix (#1662) 2020-07-27 22:27:33 +02:00
Mikhail Zabaluev
82156deac5
Support /dns protocol in multiaddr (#1575)
* Add /dns protocol support to multiaddr

The /dns protocol has been added to the spec and has had a de-facto
meaning for years.
See https://github.com/multiformats/multiaddr/pull/100

This adds address parsing and encoding support for /dns to the multiaddr
format library.

* Cover Dns protocol in multiaddr property tests

* transports/dns: Support the /dns protocol

* Support /dns protocol in address translation

* Translate an FQDN URL into a /dns multiaddr

* transports/websocket: Support /dns multiaddr

* Use the /dns protocol in websocket redirects

The whole thing with back-translating from an redirect URL looks a bit
baroque, but at least now the transport does not completely ignore IPv6
addresses resolved from a hostname in a redirect URL.

* Add CHANGELOG entry

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-05-18 10:21:55 +02:00
Toralf Wittner
afb1c877a3
multiaddr: Fix generation of arbitrary onion addr. (#1451)
Exclude port 0 which is not a valid port number for onion addresses.
2020-02-12 20:27:17 +01:00
Akihito Nakano
69852a580b
Add dnsaddr (#1356)
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-02-06 13:54:50 +01:00
Stan Bondi
955b60796a
Added Onion3 support to multiaddr (#1354) 2020-02-04 13:40:57 +01:00
Akihito Nakano
d83619109b Add protocol string to Error::UnknownProtocolString (#1355)
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-01-07 12:36:37 +01:00
Pierre Krieger
e7ab8eb1c3
Allow a path for WS multiaddresses (#1093)
* Allow a path for WS multiaddresses

* Fix tests

* Finish

* Tests

* Don't accept any path other than /
2019-05-24 14:12:44 +02:00
Toralf Wittner
5a465b7f50
Fix multiaddr::util::BytesWriter. (#1068)
The current implementation does not properly reserve enough space for
`Write::write_all` to succeed. The property test has been improved to
trigger that issue.
2019-04-18 14:28:47 +02:00
Toralf Wittner
ca58f8029c
Remove Transport::nat_traversal and refactor multiaddr. (#1052)
The functionality is available through `Multiaddr::replace`.
What we currently call "nat_traversal" is merley a replacement of an IP
address prefix in a `Multiaddr`, hence it can be done directly on
`Multiaddr` values instead of having to go through a `Transport`.

In addition this PR consolidates changes made to `Multiaddr` in
previous commits which resulted in lots of deprecations. It adds some
more (see below for the complete list of API changes) and removes all
deprecated functionality, requiring a minor version bump.

Here are the changes to `multiaddr` compared to the currently published
version:

1.  Removed `into_bytes` (use `to_vec` instead).
2.  Renamed `to_bytes` to `to_vec`.
3.  Removed `from_bytes` (use the `TryFrom` impl instead).
4.  Added `with_capacity`.
5.  Added `len`.
6.  Removed `as_slice` (use `AsRef` impl instead).
7.  Removed `encapsulate` (use `push` or `with` instead).
8.  Removed `decapsulate` (use `pop` instead).
9.  Renamed `append` to `push`.
10. Added `with`.
11. Added `replace`.
12. Removed `ToMultiaddr` trait (use `TryFrom` instead).
2019-04-17 20:12:31 +02:00
Toralf Wittner
98b2517403
Change Multiaddr representation to Bytes. (#1041)
* Change `Multiaddr` representation to `Bytes`.

* Mark several `Multiaddr` methods as deprecated.
2019-04-08 10:57:09 +02:00
Pierre Krieger
43e4d1f589
Rewrite the MemoryTransport to be similar to the TcpConfig (#951)
* Rewrite the MemoryTransport to be similar to the TcpConfig

* Add small test

* Test and bug fixes
2019-02-18 17:05:50 +01:00
Roman Borschel
eeed66707b Address edition-2018 idioms. (#929) 2019-02-11 14:58:15 +01:00
Pierre Krieger
d94a768bd9
Rename multiaddr and mulithash to parity-* (#737)
* Rename multiaddr and mulithash to parity-*

* Fix doctests
2018-12-07 15:40:02 +01:00
Toralf Wittner
69eafd9869 multiaddr: change UDP constant from 17 to 273. (#714)
Fixes #692
2018-11-30 21:10:49 +01:00
Toralf Wittner
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
Toralf Wittner
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
Toralf Wittner
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
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