-
Notifications
You must be signed in to change notification settings - Fork 18k
net: DNS resolver use both A and AAAA queries if only tcp4 network use #71281
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
Comments
You can try Resolver.LookupNetIP, there you can pass the network as a parameter. Not sure whether there is anything that we can do here. |
I think it's up to the caller to provide an appropriate Dial function to Resolver. |
I'm not sure that's right. See #45024. |
@ianlancetaylor can you explain further? 53dd0d7 |
#45024 makes Dial aware of the network, but this report sounds like grpc's equivalent of Dial indiscriminately uses LookupHost without passing any way of letting Resolver know what network it should restrict the results to. |
CC @neild |
@mateusz834 What I mean is: the described behavior sounds like something we have fixed in the past. I don't know if there is a real bug here. |
The bug report mentions LookupHost, which does not accept the the network parameter, thus i think that this behaviour is fine. I don`t understand this:
Where the "tcp4" is explicitly specified? You mention that it uses LookupHost, which uses "ip". |
I think I misunderstood something last time. I assumed that if I created an GRPC connection with a custom dialer that explicitly specified the use of tcp4, then the DNS resolver would also take this information into account.
But it looks like these are two independent parts and grpc resolver always use LookupHost. |
yes grpc has its own pluggable resolver setup |
I'm going to close this as it's a gRPC issue, see https://grpc.io/docs/guides/custom-name-resolution/ |
Thanks. |
Ok, thanks |
Go version
go1.23.4
Output of
go env
in your module/workspace:What did you do?
Hello, I'm trying to get dns resolver in grpc to use only A queries, instead of using both A and AAAA. It use method LookupHost from dns resolver:
https://github.com/golang/go/blob/master/src/net/lookup_unix.go#L55
Which uses either "cgoLookupHost" or "goLookupHostOrder" method, depending on the chosen resolver. But in both of them, the use of "ip" in the network argument is hardcoded, which leads to the use of both ipv4 and ip6 as I understand it.
So, Is this behavior correct and can it be used only "A" dns queries?
What did you see happen?
Both A and AAAA dns queries use.
What did you expect to see?
Only A dns queries use if tcp4 usage is explicitly specified
The text was updated successfully, but these errors were encountered: