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

refactor: Backwards compatible Encapsulate/Decapsulate/Join #272

Merged
merged 6 commits into from
Feb 24, 2025

Conversation

MarcoPolo
Copy link
Contributor

This changes Multiaddr.Encapsulate and Multiaddr.Decapsulate to be able to accept either a Multiaddr or Component as before. This reduces the amount of breaking changes in v0.15. The downside is more complexity and introducing another Component pointer in NewComponent so that it just works with Encapsulate/Decapsulate/Join.

We may also be able to get rid of the .Empty check and have folks check against nil as before. Note that this should avoid the original problems in v0.14 as we aren't behind an interface. It does however make it possible to hit a nil pointer panic where you couldn't before as you didn't have a pointer to begin with.

This would obviate the need for these changes:

@MarcoPolo MarcoPolo requested a review from sukunrt February 22, 2025 00:30
MarcoPolo and others added 4 commits February 24, 2025 11:19
prefer the simpler `len` check for Multiaddr and `== nil` for
`*Component`.
Export Multiaddrer interface
@MarcoPolo MarcoPolo merged commit 4d1f355 into master Feb 24, 2025
7 checks passed
@p-shahi p-shahi mentioned this pull request Feb 26, 2025
9 tasks
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

Successfully merging this pull request may close these issues.

2 participants