Closed lo-simon closed 11 months ago
Exposes quite a lot of implementation detail... unless this is only for test code, maybe it might be better to put a getaddrinfo
on the service_discovery
interface in the style of resolve
?
Thanks, @garethsb, we want it to be opened, so it is not for test code. I was thinking the same, but not sure whether to bring it into service_discovery
or some other class. Okay let's do it in service_discovery
, will do an update shortly.
@lo-simon depending on use case, would host_addresses
be sufficient?
@lo-simon depending on use case, would
host_addresses
be sufficient?
Using the host_addresses
will not be making the hostname resolution via the DNS server specified in resolv.conf configured on the device. Therefore opening up the getaddrinfo
is necessary.
Hmm, that is surprising, I thought it should use the system resolver that would use resolv.conf if configured correctly.
As discussed earlier today, it would be good to have a clear, demonstrated, use case, where using DNSServiceGetAddrInfo produces the required result but POSIX getaddrinfo
(which does use nsswitch.conf and resolv.conf on Linux) via Boost.Asio via our host_addresses
function doesn't.
If that is the case, this revised PR looks nice. Just a couple of questions:
address_result
like the results of resolve and browse are vectors of their respective types?can the DNSServiceGetAddrInfo callback be called multiple times to return more than one address, i.e. should the result be vector-of-address_result like the results of resolve and browse are vectors of their respective types?
The function wrapped the mdns_details::getaddrinfo
, which executes the DNSServiceRefDeallocate
after receiving the 1st addrinfo
to prevent any more DNSServiceGetAddrInfo callback. But the wrapped function should also be returning a vector of results as in case no mDNSResponder is used, host_addresses
will be used which will be returning a list of ipaddresses.
is it OK to require internet access in the test code (resolving Google DNS to 8.8.8.8)?
As it is already passing the testDnsGetAddrInfo
unit test, the runner must be able to access the internet.
Open the
getaddrinfo
for public use. It is a beneficial function which can look up IP address from the hostname.