-
Notifications
You must be signed in to change notification settings - Fork 640
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
Add API for configuring a custom HostsFileEntriesResolver #1831
Conversation
@KimJejun Once this PR is merged you will be able to do the following:
This example returns the first resolved address, but it is not limited to the first entry only. |
I was confused for a bit by Netty's
That's a bummer, but a limitation of the Netty API. Note that in the provided example in comment above, the DefaultHostsFileEntriesResolver defaultResolver = new DefaultHostsFileEntriesResolver();
List<InetAddress> addresses = defaultResolver.addresses(inetHost, resolvedAddressTypes);
return addresses != null && !addresses.isEmpty() ? addresses.get(0) : null; |
So this actually fixes the issue because the |
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.
DnsNameResolver
usingHostsFileEntriesResolver
does check if it is the default instance in which case it returns the whole list, while user-provided resolvers can only return a single address...
I wonder: should this and the snippet you provided (or my edit) be mentioned in the reference doc @violetagg ?
This is a rare case and for the moment I do not intend to provide an example in the ref documentation. |
@violetagg Thanks. I will try this when released |
Fixes #1822