hickory-dns / hickory-dns

A Rust based DNS client, server, and resolver
Other
4.08k stars 466 forks source link

Support user-specified location for /etc/hosts file #251

Open briansmith opened 7 years ago

briansmith commented 7 years ago

Some uses of Trust-DNS, in particular some kinds of tests for applications that use Trust-DNS, would benefit from being able to specify the path of the /etc/hosts file. Perhaps instead of having a boolean flag indicating whether to use /etc/hosts, the setting could instead become a PathBuf that contains the path to the file?

briansmith commented 7 years ago

In particular, it seems like it would be useful to have this functionality for the purposes of testing the implementation of Hosts, especially on platforms that don't have /etc/hosts and/or where /etc/hosts is in a different place. For example, it would be great to be able to run all the tests for Hosts on Windows so that WIndows-based contributors can be more sure that they didn't break anything related to it before submitting a PR.

(As it is now, rustc emits a bunch of warnings when building this code for Windows because it is dead on Windows.)