Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Query OS to find a DNS server before defaulting to Google 8.8.8.8 DNS #70

Closed
wants to merge 6 commits into from
Closed

Query OS to find a DNS server before defaulting to Google 8.8.8.8 DNS #70

wants to merge 6 commits into from

Conversation

bkidwell
Copy link

In release 0.4.13 of reactphp/dns (Feb 2018) they added support for asking the host OS for a DNS server address instead of requiring that the calling module provide one.

We should use this instead of hard-coding Google 8.8.8.8 as the only DNS server Phergie will ever use.

This patch will cause blocking IO the first time you do a DNS query, as the reactphp/dns uses the appropriate method to get the DNS server address from the host OS. This blocking should only ever happen once per Phergie launch, and should take less than a second, I think.

Note: without a patch like this one, Phergie will fail hard when trying to find and connect to a private IRC server on the local network if the server isn't available on the public Internet.

@@ -17,7 +17,7 @@
"react/event-loop": "^1.0 || ^0.5",
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4",
"react/socket": "^1.0 || ^0.8 || ^0.7",
"react/dns": "~0.4.0",
"react/dns": "~0.4.13",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well target ^1.2 || ^0.4.13 since react/dns 1.0 has been out for a while

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make this edit tonight.

Copy link
Author

@bkidwell bkidwell Aug 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this change and tests failed in Travis-CI and I have no idea what the error messages mean. Can someone help?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the failure in commit 90fe2c0 I think adopting react/dns 1.x is out of scope for this pull request.

@elazar
Copy link
Member

elazar commented Aug 16, 2019

Aside from the comment from @WyriHaximus, this looks good to me. 👍

@elazar
Copy link
Member

elazar commented Aug 17, 2019

Phake is no longer able to mock Resolver because it's been made final in the newer version of react/dns. The newer version does provide a ResolverInterface interface to typehint against, but that only exists in the newer version. It may take further consideration to come up with a solution that supports both versions of react/dns.

@WyriHaximus
Copy link
Member

Phake is no longer able to mock Resolver because it's been made final in the newer version of react/dns. The newer version does provide a ResolverInterface interface to typehint against, but that only exists in the newer version. It may take further consideration to come up with a solution that supports both versions of react/dns.

Ow yeah hehe, mock an executor instead and wrap an actual resolver around that.

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants