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).
* libp2p-ping improvements.
* re #950: Removes use of the `OneShotHandler`, but still sending each
ping over a new substream, as seems to be intentional since #828.
* re #842: Adds an integration test that exercises the ping behaviour through
a Swarm, requiring the RTT to be below a threshold. This requires disabling
Nagle's algorithm as it can interact badly with delayed ACKs (and has been
observed to do so in the context of the new ping example and integration test).
* re #864: Control of the inbound and outbound (sub)stream protocol upgrade
timeouts has been moved from the `NodeHandlerWrapperBuilder` to the
`ProtocolsHandler`. That may also alleviate the need for a custom timeout
on an `OutboundSubstreamRequest` as a `ProtocolsHandler` is now free to
adjust these timeouts over time.
Other changes:
* A new ping example.
* Documentation improvements.
* More documentation improvements.
* Add PingPolicy and ensure no event is dropped.
* Remove inbound_timeout/outbound_timeout.
As per review comment, the inbound timeout is now configured
as part of the `listen_protocol` and the outbound timeout as
part of the `OutboundSubstreamRequest`.
* Simplify and generalise.
Generalise `ListenProtocol` to `SubstreamProtocol`, reusing it in
the context of `ProtocolsHandlerEvent::OutboundSubstreamRequest`.
* Doc comments for SubstreamProtocol.
* Adapt to changes in master.
* Relax upper bound for ping integration test rtt.
For "slow" CI build machines?
Replace the listener and address pair returned from `Transport::listen_on` with just a listener that produces `ListenerEvent` values which include upgrades as well as address changes.
* Documentation updates:
* libp2p: Update the top-level module documentation, already including
intra-rustdoc links, removing outdated documentation, updating examples and
polishing the text.
* libp2p-core: Update the transport documentation to clarify that a `Transport`
is really an abstraction only for connection-oriented transports.
* More links
* Fix typo.
* Address review comments.
* More doc tweaks.
* Mention the necessity of creating an identity keypair.
* Remove another mention of the removed Topology trait.
* Consolidate keypairs in core.
Introduce the concept of a node's identity keypair in libp2p-core,
instead of only the public key:
* New module: libp2p_core::identity with submodules for the currently
supported key types. An identity::Keypair and identity::PublicKey
support the creation and verification of signatures. The public key
supports encoding/decoding according to the libp2p specs.
* The secio protocol is simplified as a result of moving code to libp2p-core.
* The noise protocol is slightly simplified by consolidating ed25519
keypairs in libp2p-core and using x25519-dalek for DH. Furthermore,
Ed25519 to X25519 keypair conversion is now complete and tested.
Generalise over the DH keys in the noise protocol.
Generalise over the DH keys and thus DH parameter in handshake patterns
of the Noise protocol, such that it is easy to support other DH schemes
in the future, e.g. X448.
* Address new review comments.
* Add a BandwidthLogging transport wrapper
* Update src/bandwidth.rs
Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>
* Limit by bytes.len
* Write test for bandwidth report
* Use the vector length instead of rolling_seconds
* Add an Error associated type to transports
* Improve raw swarm a bit
* Rename map_other to map
* Use source() instead of cause()
* RawSwarmIncErr -> IncomingError
* Add a floodsub example with the new Swarm
* WIP fixes for Floodsub chat-example code
* cleanup
* Address grumbles
* Update docs
* Update to newest master
* Add ProtocolsHandlerSelect
* Add a custom derive for NetworkBehaviour
* Remove 2018 edition
* More work
* Update the tests and work
* Allow ignored fields
* More fixes
* Give access to everything in the poll method
* 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
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.
* Introduce NULL cipher and allow more configuration.
* Back to using the hash-code for handshake.
Using `Endpoint` would be incompatible with the existing protocol.
* Add comments.