* hostsfile: change internal map from hash to btree
This change makes the innernet section of /etc/hosts always ordered and
deterministic. We can take advantage of that to avoid writes, that will
be done in another commit.
* hostsfile: reduce number of writes if content hasn't changed
* hostsfile: return bool to inform if file has been written
This commit also makes the logs print accordingly to the new behavior.
* hostsfile: remove has_content_changed in favor of comparing old and new sections
* hostsfile: print the correct hosts path in log message
* hostsfile: remove unnecessary intermediate variable
Windows has some peculiarities for example it only allows one hostname per line
and the file's location depends on an environment variable. Although in most
cases just using C:\Windows\ for %WinDir% would probably work.
Note that editing the hosts file on Windows will require running with elevated
privileges ("Run as Administrator") and in some cases also antivirus may block
access to the file.
Introduces `--hosts-path [PATH]` and `--no-write-hosts` options in `innernet`.
This could be further improved to have a persistent setting in a config file i.e. /etc/innernet.conf (which doesn't currently exist).
Fixes#6