* core/src/translation: Add unit tests
* core/src/translation: Support dns4 and dns6
Add dns4 and dns6 as valid protocol replacements for the origin address
to construct external addresses of a given node.
* core/nodes/network: %s/nat_translation/address_translation/
When receiving an observed address on a tcp connection that we initiated, the
observed address contains our tcp dial port, not our tcp listen port. We know
which port we are listening on, thereby we can replace the port within the
observed address.
When receiving an observed address on a tcp connection that we did **not**
initiated, the observed address should contain our listening port. In case it
differs from our listening port there might be a NAT along the path.
With the above in mind, the function name `nat_translation` is misleading.
* Add parity_multiaddr::from_websockets_url
* Make from_websockets_url more genreic
* Oops, forgot the file
* Use the URL crate
* Add dns_and_port test
* Address review
* Add support for unix
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).
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.
* Use `unsigned-varint` crate.
* Implement `Display` for `Protocol`.
Gives `ToString` for free.
* Use `Cow` in `AddrComponent`.
* Add `AddrComponent::acquire`.
* Document `AddrComponent::acquire`.