-
Notifications
You must be signed in to change notification settings - Fork 152
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
Make it not fail if it can't find /etc/resolv.conf #63
Conversation
Please merge it, I also need this fix. :) |
Hmm, this fix could be done better. Instead of ignoring the error, the error can be checked to see if it's because the file wasn't found, and in that case |
something like this? (see new patch) |
On OSX /etc/resolv.conf is generated by the OS anytime the network changes. If I create a network "By picking 'Create Network...'" from the wifi menu then there is no /etc/resolv.conf and the throw that was here would .. uh, .. throw. Making it not throw makes the dns-server work for my purposes.
👍 |
Another approach for OS X could be to use |
@taoeffect Any time frame on when you could merge this? It seems you have commit access and could publish on npm too. sindresorhus/is-online#8 depends on this issue and we're pondering whether to fork this module with this fix included. |
@silverwind Thanks for the poke. I just pushed latest changes to my PR for I bumped its version to 0.1.0, and am now waiting for @tjfontaine to review and OK the PR to be merged into After that (or at the same time) we can merge this PR. Ball is in @tjfontaine's court. Sorry for taking so long on this! |
Once tjfontaine/node-dns#63 gets merged, we should switch back to using the original version.
@taoeffect sounds good, hopefully this project will see a bit activity again soon! If time permits, I'll have a look at your changes. |
lgtm, @taoeffect merge it? |
actually let me correct that, we need to also need to set |
From my testing with this patch, it looks to be working. I set off a request with all interfaces down on OS X and got a |
While I haven't yet understood the intricacies of how OS X manages I can do PR for this fallback, but I'd have to study how OS X manages these files first. |
Ok thinking about this more, here are my full thoughts: We should probably have a way to instantiate a platform that represents
but you could later, recreate another (and even potentially replace the existing one [may be bad hygeine]) with other places where you expect to find those files. var dns = require('native-dns')
newdns = dns.createNativeDNS({
hostsFiles: '/private/etc/hosts',
resolvConf: '/private/etc/resolv.conf',
});
// maybe?
dns.setDefaultImplementation(newdns); Also the interface for setting the "platform" (i.e. default nameservers) is wrong, it shouldn't be A further improvement would be if there is nothing in So in short:
|
Thanks for the detailed writeup, I think this merits an issue of its own. But could we get this PR (after review from @taoeffect) merged and pushed to npm? Right now we're relying on a fork with this fix in is-online, as this |
#71 has been merged! 0.7.0 has been published! Thanks @tjfontaine! (Hope it doesn't break things for anyone! crosses fingers). I've gotta run for now, but I will read the comments above and merge this if all is good. (@tjfontaine: TLDR, does it lgty? Or are you requesting something else?) |
@taoeffect from above:
I'd say we merge it and open an own issue for the platform rework described above. |
👍 |
@taoeffect nudge nudge (we still depend on this PR's branch, would love seeing this merged and released) |
@silverwind OK, this looks harmless enough, I'll add merging this to my TODO for tomorrow. POKE ME PLZ if I fail to do that!! I even give you permission to badger me on twitter (if I forget to do it, I will be grateful for any reminders!): @taoeffect |
Make it not fail if it can't find /etc/resolv.conf
OK, merged! Now, is this little change worth making a release for? I am of no opinion either way, so you folks tell me what to do! (Esp. @tjfontaine if you've a mind on it.) |
Thank you ❤️ To help you on that, I'll look into the issues and PRs for any critical stuff on which I can help. #87 sounds pretty serious if true. I should be able to finish this on the weekend hopefully. |
Awesome! Thanks much @silverwind! 😄 |
Thanks @silverwind! Merged #84 and #90, but the others I have some questions/concerns that need to be addressed before I feel OK merging them. I know most everyone who's working on this is doing it in their volunteer time (including myself), and my time's up. Would be oh so awesome if I could get some help reviewing #82 and #83! (See my comments there.) |
@taoeffect thanks for your effort. I'm not sure I'll be motivated enough to dive deeper into this module right now, as the addition of There's a lot of low-level stuff this module provides to which there's really no alternative in node-land right now, so I hope this module will be in a better shape soon. |
@taoeffect Any chance you could do a new release? |
@sindresorhus I am swamped at the moment with other commitments, I posted a call for help here. |
Once tjfontaine/node-dns#63 gets merged, we should switch back to using the original version.
On OSX /etc/resolv.conf is generated by the OS anytime the network
changes. If I create a network "By picking 'Create Network...'" from
the wifi menu then there is no /etc/resolv.conf and the throw
that was here would .. uh, .. throw.
Making it not throw makes the dns-server work for my purposes.
I don't know if this is how you like to deal with that or if you'd like some flag or check or OSX only or what but I thought I'd at least pass on what I needed to do to get it to work for me.