-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
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.
835ae1f
to
8c560f5
Compare
if protos[0].Code == p.Code { | ||
return true | ||
func Matches(maddr ma.Multiaddr) (matches bool) { | ||
ma.ForEach(maddr, func(c ma.Component) bool { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
This means we now support addresses like:
Note: We still can't specify dnsaddr anywhere except the end, unfortunately.