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

fix: return correct family from toOptions with dns4 MultiAddr #233

Merged
merged 3 commits into from
Jul 7, 2022

Conversation

binarybaron
Copy link
Contributor

@binarybaron binarybaron commented Mar 27, 2022

When calling toOptions with a dns4 multiaddress, a MultiaddrObject is returned where the ip family is 6 instead of 4. This causes an issue where libp2p is unable to resolve the domain and dial the peer. This only appears to be an issue on some systems. It works on Mac OS but fails on for example Alpine Linux.

Example:

const {multiaddr} = require("multiaddr")

console.log(multiaddr('/dns4/google.net/tcp/8000').toOptions())`
Object {family: 6, host: "google.net", transport: "tcp", port: 8000}

…tiAddr

When calling toOptions with a dns4 multiaddress, a MultiaddrObject is returned where the ip family is 6 instead of 4. This causes an issue where libp2p is unable to resolve the domain and dial the peer. This only appears to be an issue on some systems. It works on Mac OS but fails on for example Alpine Linux.

Example:
```const {multiaddr} = require("multiaddr")

console.log(multiaddr('/dns4/google.net/tcp/8000').toOptions())`
```

```
Object {family: 6, host: "google.net", transport: "tcp", port: 8000}
```
@alxdca
Copy link

alxdca commented Jul 7, 2022

Can confirm the issue. Returning family: 6 when passing /dns4 breaks DNS resolution on Linux.

@achingbrain achingbrain changed the title Return correct MultiaddrObject when calling toOptions with dns4 Mul… fix: return correct MultiaddrObject when calling toOptions with dns4 MultiAddr Jul 7, 2022
@achingbrain achingbrain changed the title fix: return correct MultiaddrObject when calling toOptions with dns4 MultiAddr fix: return correct family when calling toOptions with dns4 MultiAddr Jul 7, 2022
@achingbrain achingbrain changed the title fix: return correct family when calling toOptions with dns4 MultiAddr fix: return correct family from toOptions with dns4 MultiAddr Jul 7, 2022
@achingbrain achingbrain merged commit d3f8b05 into multiformats:master Jul 7, 2022
@achingbrain
Copy link
Member

Thanks!

github-actions bot pushed a commit that referenced this pull request Jul 7, 2022
## [10.3.3](v10.3.2...v10.3.3) (2022-07-07)

### Bug Fixes

* return correct family from toOptions with dns4 MultiAddr ([#233](#233)) ([d3f8b05](d3f8b05))
@github-actions
Copy link

github-actions bot commented Jul 7, 2022

🎉 This PR is included in version 10.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@binarybaron
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants