amphp / dns

Async DNS resolution for PHP based on Amp.
https://amphp.org/dns
MIT License
157 stars 32 forks source link

More resolv.conf features #89

Closed brzuchal closed 5 years ago

brzuchal commented 5 years ago

This PR resolves #47 All added features works the same way as glibc implementation of resolv.conf Changes:

Valid resolv.conf format (from Travis CI):

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 169.254.169.254
search c.travis-ci-prod-2.internal google.internal
options timeout:1
options attempts:3
options ndots:3
options rotate

All max and default values are taken from resolv/res_init.c and from man

brzuchal commented 5 years ago

Tests not passing on Travis using 169.254.169.254 nameserver. The issue was in options timeout:1 cause its unit is seconds, not milliseconds.

brzuchal commented 5 years ago

Integration test fails on x64 platform on AppVeyor randomly.

1) Amp\Dns\Test\IntegrationTest::testResolve with data set #2 ('stackoverflow.com')
Amp\Dns\DnsException: All query attempts failed for stackoverflow.com: No response for 'stackoverflow.com' (A) from any nameserver after 2 attempts, tried udp://8.8.8.8:53, udp://8.8.4.4:53, No response for 'stackoverflow.com' (AAAA) from any nameserver after 2 attempts, tried udp://8.8.8.8:53, udp://8.8.4.4:53

@kelunik shouldn't we use default OS settings there?

kelunik commented 5 years ago

@brzuchal Probably, yes.

Merged, thanks! :tada: