PHP-DNS-SERVER icon indicating copy to clipboard operation
PHP-DNS-SERVER copied to clipboard

Google DNS over HTTPS resolver

Open ivanstan opened this issue 6 years ago • 3 comments

This branch adds a new resolver that uses Google's HTTPS service to resolve DNS records user requested. Another example file is provided which shows proof of concept.

ivanstan avatar Jan 28 '19 18:01 ivanstan

I've finally gotten around to review this, and it does not work for me... In your tests, you're not testing the getAnswer method which is pretty important...

samuelwilliams avatar Feb 02 '19 01:02 samuelwilliams

I was thinking how to achieve that but getAnswer would fire an http request and that would not be a unit test anymore. Maybe you have an idea how to improve this test?

ivanstan avatar Feb 04 '19 07:02 ivanstan

Fair point, it is no longer a unit test. But the fact remains that I cannot get the feature to work. I'm not familiar with the API, do you need a key or something?

samuelwilliams avatar Feb 06 '19 09:02 samuelwilliams

No key is needed for API consumption. And I completely agree with you that the test is insufficient. Perhaps I could write a functional test and actually contact the API, the main concern is would CI allow outcoming HTTP request. Other thing I'm willing to try is mocking, that would involve extracting method that contacts the API in separate service and injecting it in resolver - this way the whole service could be replaced with stub. I will try second solution in following days.

ivanstan avatar Feb 06 '19 09:02 ivanstan