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

flesh out resolution logic and support /dns #17

Merged
merged 3 commits into from
Sep 30, 2019
Merged

Conversation

Stebalien
Copy link
Member

  1. Support the /dns protocol (resolves to both ip4/ip6.
  2. Flesh out resolution logic so we can resolve multiple domains anywhere in the address (instead of one at the start.

This means we now support addresses like:

/dns/a.com/tcp/1234/p2p/QmRelay/p2p-circuit/dnsaddr/p2p/QmTarget

Note: We still can't specify dnsaddr anywhere except the end, unfortunately.

@Stebalien Stebalien requested review from a user and whyrusleeping July 9, 2019 20:27
Stebalien added a commit to multiformats/go-multiaddr that referenced this pull request Sep 19, 2019
This is a defacto standard and is used by js-libp2p.

Ported from multiformats/go-multiaddr-dns#17.
This was decided in multiformats/multiaddr#22.
1. Handle multiple dns{4,6,addr} anywhere in an address.
2. Try to allocate less.
if protos[0].Code == p.Code {
return true
func Matches(maddr ma.Multiaddr) (matches bool) {
ma.ForEach(maddr, func(c ma.Component) bool {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version doesn't allocate.

ip4maddr, err := ma.NewMultiaddr("/ip4/" + ip4.String())
if err != nil {
return result, err
var results []ma.Multiaddr
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support resolving /dns[46] anywhere in an address, multiple times. Currently, we'll only resolve this at the beginning of the address.

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.

1 participant