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

Feature/dns resolver #80

Merged
merged 20 commits into from
Dec 12, 2019
Merged

Feature/dns resolver #80

merged 20 commits into from
Dec 12, 2019

Conversation

jezhiggins
Copy link
Contributor

Implements /dns4/hostname and /dns6/hostname resolution, resolving issue #70

I'm using go-multiaddr-dns as a guide.
Don't want exceptions propagating out of here. We can handle the error
case higher up. This is similar to the case where, for example, we
request a dns6 resolution on a name which only has an ip4 address. If
people need detailed reporting on DNS failures they can investigate
afterwards
src/main/kotlin/io/libp2p/core/multiformats/Multiaddr.kt Outdated Show resolved Hide resolved
src/main/kotlin/io/libp2p/core/multiformats/Multiaddr.kt Outdated Show resolved Hide resolved
companion object {
private val dnsProtocols = arrayOf(Protocol.DNS4, Protocol.DNS6, Protocol.DNSADDR)

fun resolve(addr: Multiaddr, resolver: Resolver = DefaultResolver): List<Multiaddr> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would consider asynchronous invocation here (aka CompletableFuture) since the DNS resolution may take a lot of time.
It also may make sense to check what non-blocking DNS resolve solutions exist to make it possible to resolve DNS in parallel without using a lot of threads

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is something to think about, yes.

There is further work to do around DNS - the dnsaddr protocol, and also how we expose this as a configuration item (eg through the DSL) - so I'll come back and address that then.

Copy link
Contributor

@shahankhatch shahankhatch left a comment

Choose a reason for hiding this comment

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

LGTM. A good example and flow of adding a protocol to multiaddr resolution.

@jezhiggins jezhiggins merged commit 626765e into develop Dec 12, 2019
@jezhiggins jezhiggins deleted the feature/dns-resolver branch December 12, 2019 09:15
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.

3 participants