Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Multiaddr internal structure to store parsed address #19

Open
progval opened this issue Sep 18, 2016 · 1 comment
Open

Change Multiaddr internal structure to store parsed address #19

progval opened this issue Sep 18, 2016 · 1 comment

Comments

@progval
Copy link
Contributor

progval commented Sep 18, 2016

As of now, Multiaddr stores a byte array, representing the serialized version of the address.

Although this allows very fast serialization (array copy), I believe this is not the most appropriate format.
Indeed, operations on Multiaddr (eg. decapsulate) actually work on the list of protocols, and not on the byte representation. The bug mentioned in PR #18 is a good example of it.

I see two possible representations:

  • Make Multiaddr store a Vec<Addr>, with Addr being an Enum for all supported protocols
  • Make Multiaddr only store an Addr and an Option<Multiaddr> for the inner and/or outer multiaddr.
@dignifiedquire
Copy link
Member

So my goal with how it is currently stored was to have internally the same byte representation as go-multiaddr has. If we move away from that, there needs to be at least an option to get that byte representation via a method call.

From your suggestions I think I like using Vec<Addr> the best as that matches my mental representation of a multiaddr very well. What do you think?

ntninja added a commit to ntninja/rust-multiaddr that referenced this issue Oct 25, 2017
ntninja added a commit to ntninja/rust-multiaddr that referenced this issue Oct 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants