mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-14 10:31:21 +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:
@ -65,6 +65,7 @@ pub use multistream_select::Negotiated;
|
||||
|
||||
mod keys_proto;
|
||||
mod peer_id;
|
||||
mod translation;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
@ -78,14 +79,15 @@ pub mod swarm;
|
||||
pub mod transport;
|
||||
pub mod upgrade;
|
||||
|
||||
pub use self::multiaddr::Multiaddr;
|
||||
pub use self::muxing::StreamMuxer;
|
||||
pub use self::peer_id::PeerId;
|
||||
pub use self::protocols_handler::{ProtocolsHandler, ProtocolsHandlerEvent};
|
||||
pub use self::identity::PublicKey;
|
||||
pub use self::swarm::Swarm;
|
||||
pub use self::transport::Transport;
|
||||
pub use self::upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo, UpgradeError, ProtocolName};
|
||||
pub use multiaddr::Multiaddr;
|
||||
pub use muxing::StreamMuxer;
|
||||
pub use peer_id::PeerId;
|
||||
pub use protocols_handler::{ProtocolsHandler, ProtocolsHandlerEvent};
|
||||
pub use identity::PublicKey;
|
||||
pub use swarm::Swarm;
|
||||
pub use transport::Transport;
|
||||
pub use translation::address_translation;
|
||||
pub use upgrade::{InboundUpgrade, OutboundUpgrade, UpgradeInfo, UpgradeError, ProtocolName};
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum Endpoint {
|
||||
|
Reference in New Issue
Block a user