mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-28 01:01:34 +00:00
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).
This commit is contained in:
@ -214,10 +214,7 @@ fn unresponsive_not_returned_direct() {
|
||||
|
||||
// Add fake addresses.
|
||||
for _ in 0 .. 10 {
|
||||
swarms[0].add_not_connected_address(
|
||||
&PeerId::random(),
|
||||
libp2p_core::multiaddr::multiaddr![Udp(10u16)]
|
||||
);
|
||||
swarms[0].add_not_connected_address(&PeerId::random(), Protocol::Udp(10u16).into());
|
||||
}
|
||||
|
||||
// Ask first to search a random value.
|
||||
|
Reference in New Issue
Block a user