multiformats / rust-multiaddr

multiaddr implementation in rust
https://crates.io/crates/multiaddr
Other
86 stars 45 forks source link

General rework of the library #28

Closed tomaka closed 6 years ago

tomaka commented 6 years ago

Based over #27

Right now if you want to examine the content of the Multiaddr, you have to call as_bytes() and examine bytes one by one and making the assumptions that they are going to be in a certain format.

This PR does many minor changes to the library, and most notably adds the AddrComponent type which represents one segment of a multiaddr in a strongly-typed fashion. The components can be enumerated with Multiaddr::iter(). Because of this large change, parsing has also been reworked.

tomaka commented 6 years ago

This PR is an upstream of the local changes we've been making as part of https://github.com/libp2p/rust-libp2p/tree/master/rust-multiaddr

All these changes have already been reviewed. If nobody expresses opposition, I will merge in a few days.